1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-08 14:24:36 -04:00
v2fly/transport/internet/udp/connection.go

31 lines
527 B
Go
Raw Normal View History

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