Browse Source

Prototype for socks5 proxy server

pull/298/head
V2Ray 9 years ago
parent
commit
6da69879ee
  1. 35
      net/sockshandler.go

35
net/sockshandler.go

@ -0,0 +1,35 @@
package net
import (
"net"
)
// SocksServer is a SOCKS 5 proxy server
type SocksServer struct {
accepting bool
}
func (server *SocksServer) Listen(port uint8) error {
listener, err := net.Listen("tcp", ":"+string(port))
if err != nil {
return err
}
server.accepting = true
go server.AcceptConns(listener)
return nil
}
func (server *SocksServer) AcceptConnections(listener net.Listener) error {
for server.accepting {
connection, err := listener.Accept()
if err != nil {
return err
}
go server.HandleConnection(connection)
}
return nil
}
func (server *SocksServer) HandleConnection(connection *net.Conn) error {
return nil
}
Loading…
Cancel
Save