var validSchemes … // SplitSchemeNamePort takes a string of the following forms: // - "<name>", returns "", "<name>","", true // - "<name>:<port>", returns "", "<name>","<port>",true // - "<scheme>:<name>:<port>", returns "<scheme>","<name>","<port>",true // // Name must be non-empty or valid will be returned false. // Scheme must be "http" or "https" if specified // Port is returned as a string, and it is not required to be numeric (could be // used for a named port, for example). func SplitSchemeNamePort(id string) (scheme, name, port string, valid bool) { … } // JoinSchemeNamePort returns a string that specifies the scheme, name, and port: // - "<name>" // - "<name>:<port>" // - "<scheme>:<name>:<port>" // // None of the parameters may contain a ':' character // Name is required // Scheme must be "", "http", or "https" func JoinSchemeNamePort(scheme, name, port string) string { … }