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