Commit 7c5760eb authored by alexstocks's avatar alexstocks

add HostAddress2 & HostPort in utility.go

parent 1b4ba19b
...@@ -15,11 +15,27 @@ import ( ...@@ -15,11 +15,27 @@ import (
"time" "time"
) )
/////////////////////////////////////////
// network utility
/////////////////////////////////////////
// HostAddress composes a ip:port style address. Its opposite function is net.SplitHostPort. // HostAddress composes a ip:port style address. Its opposite function is net.SplitHostPort.
func HostAddress(host string, port int) string { func HostAddress(host string, port int) string {
return net.JoinHostPort(host, strconv.Itoa(port)) return net.JoinHostPort(host, strconv.Itoa(port))
} }
func HostAddress2(host string, port string) string {
return net.JoinHostPort(host, port)
}
func HostPort(addr string) (string, string, error) {
return net.SplitHostPort(addr)
}
/////////////////////////////////////////
// count watch
/////////////////////////////////////////
type CountWatch struct { type CountWatch struct {
start time.Time start time.Time
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment