improve cmd
This commit is contained in:
@ -74,9 +74,12 @@ func (r *Router) resolve(ctx context.Context, addr string) (string, error) {
|
||||
}
|
||||
|
||||
host, port, err := net.SplitHostPort(addr)
|
||||
if err != nil || host == "" {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if host == "" {
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
if r.Hosts != nil {
|
||||
if ips, _ := r.Hosts.Lookup("ip", host); len(ips) > 0 {
|
||||
|
@ -93,6 +93,10 @@ func GetDuration(md Metadata, key string) (v time.Duration) {
|
||||
return time.Duration(vv) * time.Second
|
||||
case string:
|
||||
v, _ = time.ParseDuration(vv)
|
||||
if v == 0 {
|
||||
n, _ := strconv.Atoi(vv)
|
||||
v = time.Duration(n) * time.Second
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user