Add addr to ListenSerial result

This commit is contained in:
世界 2023-04-02 11:24:41 +08:00
parent 8afcf45878
commit 8d4b1ac38d
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -31,7 +31,7 @@ func DialSerial(ctx context.Context, dialer Dialer, network string, destination
return nil, E.Errors(connErrors...) return nil, E.Errors(connErrors...)
} }
func ListenSerial(ctx context.Context, dialer Dialer, destination M.Socksaddr, destinationAddresses []netip.Addr) (net.PacketConn, error) { func ListenSerial(ctx context.Context, dialer Dialer, destination M.Socksaddr, destinationAddresses []netip.Addr) (net.PacketConn, netip.Addr, error) {
var conn net.PacketConn var conn net.PacketConn
var err error var err error
var connErrors []error var connErrors []error
@ -41,9 +41,9 @@ func ListenSerial(ctx context.Context, dialer Dialer, destination M.Socksaddr, d
connErrors = append(connErrors, err) connErrors = append(connErrors, err)
continue continue
} }
return conn, nil return conn, address, nil
} }
return nil, E.Errors(connErrors...) return nil, netip.Addr{}, E.Errors(connErrors...)
} }
func DialParallel(ctx context.Context, dialer Dialer, network string, destination M.Socksaddr, destinationAddresses []netip.Addr, preferIPv6 bool, fallbackDelay time.Duration) (net.Conn, error) { func DialParallel(ctx context.Context, dialer Dialer, network string, destination M.Socksaddr, destinationAddresses []netip.Addr, preferIPv6 bool, fallbackDelay time.Duration) (net.Conn, error) {