1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-05 13:35:23 +00:00
v2fly/transport/internet/udp/connection.go

32 lines
592 B
Go
Raw Normal View History

2016-06-14 20:54:08 +00:00
package udp
import (
"net"
2016-08-20 18:55:45 +00:00
v2net "v2ray.com/core/common/net"
"v2ray.com/core/transport/internet"
2016-06-14 20:54:08 +00:00
)
type Connection struct {
net.UDPConn
}
func (this *Connection) Reusable() bool {
return false
}
func (this *Connection) SetReusable(b bool) {}
func init() {
2016-09-30 14:53:40 +00:00
internet.UDPDialer = func(src v2net.Address, dest v2net.Destination, options internet.DialerOptions) (internet.Connection, error) {
2016-06-14 20:54:08 +00:00
conn, err := internet.DialToDest(src, dest)
if err != nil {
return nil, err
}
2016-09-30 14:53:40 +00:00
// TODO: handle dialer options
2016-06-14 20:54:08 +00:00
return &Connection{
UDPConn: *(conn.(*net.UDPConn)),
}, nil
}
}