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