2016-06-14 22:54:08 +02:00
|
|
|
package udp
|
|
|
|
|
|
|
|
import (
|
2017-01-26 20:46:44 +01:00
|
|
|
"context"
|
|
|
|
|
2017-01-03 15:16:48 +01:00
|
|
|
"v2ray.com/core/common"
|
2017-08-29 12:56:57 +02:00
|
|
|
"v2ray.com/core/common/net"
|
2016-08-20 20:55:45 +02:00
|
|
|
"v2ray.com/core/transport/internet"
|
2016-06-14 22:54:08 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2018-08-06 13:48:35 +02:00
|
|
|
common.Must(internet.RegisterTransportDialer(protocolName,
|
2017-08-29 12:56:57 +02:00
|
|
|
func(ctx context.Context, dest net.Destination) (internet.Connection, error) {
|
2018-09-18 23:09:54 +02:00
|
|
|
conn, err := internet.DialSystem(ctx, dest)
|
2017-01-03 15:16:48 +01:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
// TODO: handle dialer options
|
2017-04-07 21:54:40 +02:00
|
|
|
return internet.Connection(conn), nil
|
2017-01-03 15:16:48 +01:00
|
|
|
}))
|
2016-06-14 22:54:08 +02:00
|
|
|
}
|