mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
feat(vmess): support forward/udp (#199)
This commit is contained in:
3 files changed
+41
-9
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package vmess
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// PktConn is a udp Packet.Conn.
|
||||
type PktConn struct{ net.Conn }
|
||||
|
||||
// NewPktConn returns a PktConn.
|
||||
func NewPktConn(c net.Conn) *PktConn { return &PktConn{Conn: c} }
|
||||
|
||||
// ReadFrom implements the necessary function of net.PacketConn.
|
||||
func (pc *PktConn) ReadFrom(b []byte) (int, net.Addr, error) {
|
||||
n, err := pc.Read(b)
|
||||
return n, nil, err
|
||||
}
|
||||
|
||||
// WriteTo implements the necessary function of net.PacketConn.
|
||||
func (pc *PktConn) WriteTo(b []byte, addr net.Addr) (int, error) {
|
||||
return pc.Write(b)
|
||||
}
|
||||
Reference in new issue
Block a user