github.com/xraypb/xray-core@v1.6.6/transport/internet/udp/dialer.go (about) 1 package udp 2 3 import ( 4 "context" 5 6 "github.com/xraypb/xray-core/common" 7 "github.com/xraypb/xray-core/common/net" 8 "github.com/xraypb/xray-core/transport/internet" 9 "github.com/xraypb/xray-core/transport/internet/stat" 10 ) 11 12 func init() { 13 common.Must(internet.RegisterTransportDialer(protocolName, 14 func(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (stat.Connection, error) { 15 var sockopt *internet.SocketConfig 16 if streamSettings != nil { 17 sockopt = streamSettings.SocketSettings 18 } 19 conn, err := internet.DialSystem(ctx, dest, sockopt) 20 if err != nil { 21 return nil, err 22 } 23 // TODO: handle dialer options 24 return stat.Connection(conn), nil 25 })) 26 }