Refactoring, allow exposing TCP services

This commit is contained in:
Neil Alexander 2022-02-15 17:48:09 +00:00 committed by Vasyl Gello
parent 8ac5443047
commit ae4dbc2a27
6 changed files with 218 additions and 23 deletions

View file

@ -71,7 +71,11 @@ func (s *YggdrasilNetstack) DialContext(ctx context.Context, network, address st
case "tcp", "tcp6":
return gonet.DialContextTCP(ctx, s.stack, fa, pn)
case "udp", "udp6":
return gonet.DialUDP(s.stack, nil, &fa, pn)
conn, err := gonet.DialUDP(s.stack, nil, &fa, pn)
if err != nil {
return nil, fmt.Errorf("gonet.DialUDP: %w", err)
}
return conn, nil
default:
return nil, fmt.Errorf("not supported")
}