mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
chore: update doc for info and restructure codes
This commit is contained in:
1 parent
8b6739f12c
commit
cd42337169
11 files changed
+761
-701
No files matched your search
+15
-1
@@ -49,7 +49,7 @@ func (s *VLess) Serve(c net.Conn) {
|
||||
}
|
||||
|
||||
c = NewServerConn(c)
|
||||
_, err := s.readHeader(c)
|
||||
cmd, err := s.readHeader(c)
|
||||
if err != nil {
|
||||
log.F("[vless] verify header error: %v", err)
|
||||
return
|
||||
@@ -61,6 +61,16 @@ func (s *VLess) Serve(c net.Conn) {
|
||||
return
|
||||
}
|
||||
|
||||
switch cmd {
|
||||
case CmdTCP:
|
||||
s.ServeTCP(c, tgt)
|
||||
case CmdUDP:
|
||||
s.ServeUOT(c, tgt)
|
||||
}
|
||||
}
|
||||
|
||||
// ServeTCP serves tcp requests.
|
||||
func (s *VLess) ServeTCP(c net.Conn, tgt string) {
|
||||
dialer := s.proxy.NextDialer(tgt)
|
||||
rc, err := dialer.Dial("tcp", tgt)
|
||||
if err != nil {
|
||||
@@ -80,6 +90,10 @@ func (s *VLess) Serve(c net.Conn) {
|
||||
}
|
||||
}
|
||||
|
||||
// ServeUOT serves udp over tcp requests.
|
||||
func (s *VLess) ServeUOT(c net.Conn, tgt string) {
|
||||
}
|
||||
|
||||
func (s *VLess) readHeader(r io.Reader) (CmdType, error) {
|
||||
buf := pool.GetBuffer(16)
|
||||
defer pool.PutBuffer(buf)
|
||||
|
||||
Reference in new issue
Block a user