github.com/xmplusdev/xray-core@v1.8.10/transport/internet/udp/dialer.go (about) 1 package udp 2 3 import ( 4 "context" 5 6 "github.com/xmplusdev/xray-core/common" 7 "github.com/xmplusdev/xray-core/common/net" 8 "github.com/xmplusdev/xray-core/transport/internet" 9 "github.com/xmplusdev/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 }