improve cmd

This commit is contained in:
ginuerzh
2022-01-20 23:50:56 +08:00
parent 3ef98c16aa
commit bb889412d2
3 changed files with 52 additions and 19 deletions

View File

@ -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 {