migrated multi host connection pool from godropbox package

removing unneeded dependencies, which involved etcd versions.
This commit is contained in:
Chris Lu
2021-03-06 14:24:01 -08:00
parent 3a96461be3
commit 1444e9d275
12 changed files with 1538 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package net2
import (
"net"
"strconv"
)
// Returns the port information.
func GetPort(addr net.Addr) (int, error) {
_, lport, err := net.SplitHostPort(addr.String())
if err != nil {
return -1, err
}
lportInt, err := strconv.Atoi(lport)
if err != nil {
return -1, err
}
return lportInt, nil
}