mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
trojan: support listen as trojan server
This commit is contained in:
1 parent
6eda2b79c8
commit
175ef16a5c
17 files changed
+357
-115
No files matched your search
@@ -73,11 +73,12 @@ func (pc *PktConn) ReadFrom(b []byte) (int, net.Addr, error) {
|
||||
// +----+------+------+----------+----------+----------+
|
||||
// | 2 | 1 | 1 | Variable | 2 | Variable |
|
||||
// +----+------+------+----------+----------+----------+
|
||||
tgtAddr := socks.SplitAddr(buf[3:])
|
||||
tgtAddr := socks.SplitAddr(buf[3:n])
|
||||
if tgtAddr == nil {
|
||||
return n, raddr, errors.New("can not get addr")
|
||||
}
|
||||
copy(b, buf[3+len(tgtAddr):])
|
||||
|
||||
n = copy(b, buf[3+len(tgtAddr):n])
|
||||
|
||||
//test
|
||||
if pc.writeAddr == nil {
|
||||
@@ -88,7 +89,7 @@ func (pc *PktConn) ReadFrom(b []byte) (int, net.Addr, error) {
|
||||
pc.tgtAddr = tgtAddr
|
||||
}
|
||||
|
||||
return n - len(tgtAddr) - 3, raddr, err
|
||||
return n, raddr, err
|
||||
}
|
||||
|
||||
// WriteTo overrides the original function from net.PacketConn.
|
||||
|
||||
Reference in new issue
Block a user