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
+7
-4
@@ -143,12 +143,15 @@ func (s *Server) ServeTCP(c net.Conn) {
|
||||
return
|
||||
}
|
||||
|
||||
respLen := pool.GetBuffer(2)
|
||||
defer pool.PutBuffer(respLen)
|
||||
binary.BigEndian.PutUint16(respLen, uint16(len(respBytes)))
|
||||
buf := pool.GetBuffer(2 + len(respBytes))
|
||||
defer pool.PutBuffer(buf)
|
||||
|
||||
if _, err := (&net.Buffers{respLen, respBytes}).WriteTo(c); err != nil {
|
||||
binary.BigEndian.PutUint16(buf[:2], uint16(len(respBytes)))
|
||||
copy(buf[2:], respBytes)
|
||||
|
||||
if _, err := c.Write(buf); err != nil {
|
||||
log.F("[dns-tcp] error in write respBytes: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user