mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-16 16:57:08 +00:00
docs: remove unused connection pooling code and related comments
This commit is contained in:
parent
7d526695ac
commit
1b5da5c724
47
src/main.go
47
src/main.go
@ -33,15 +33,6 @@ var whitelist = []string{
|
|||||||
|
|
||||||
const RDBUF = 1024 * 8
|
const RDBUF = 1024 * 8
|
||||||
|
|
||||||
// var dpool *ants.PoolWithFunc
|
|
||||||
// var gpool *ants.PoolWithFunc
|
|
||||||
//
|
|
||||||
// type RelayConn struct {
|
|
||||||
// src net.Conn
|
|
||||||
// dst net.Conn
|
|
||||||
// destAddrPort string
|
|
||||||
// }
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var addr string
|
var addr string
|
||||||
var port int
|
var port int
|
||||||
@ -71,11 +62,6 @@ func main() {
|
|||||||
|
|
||||||
cache = expirable.NewLRU[string, string](300, nil, time.Second*600)
|
cache = expirable.NewLRU[string, string](300, nil, time.Second*600)
|
||||||
|
|
||||||
// dpool, _ = ants.NewPoolWithFunc(1000, forward)
|
|
||||||
// gpool, _ = ants.NewPoolWithFunc(500, gforward)
|
|
||||||
// defer dpool.Release()
|
|
||||||
// defer gpool.Release()
|
|
||||||
|
|
||||||
payloadByte = []byte(payload)
|
payloadByte = []byte(payload)
|
||||||
|
|
||||||
server, err := net.Listen("tcp", fmt.Sprintf("%s:%d", addr, port))
|
server, err := net.Listen("tcp", fmt.Sprintf("%s:%d", addr, port))
|
||||||
@ -341,39 +327,6 @@ func Socks5Connect(client net.Conn) (net.Conn, string, error) {
|
|||||||
return dest, destAddrPort, nil
|
return dest, destAddrPort, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func forward(i interface{}) {
|
|
||||||
rc := i.(*RelayConn)
|
|
||||||
defer rc.src.Close()
|
|
||||||
defer rc.dst.Close()
|
|
||||||
io.Copy(rc.src, rc.dst)
|
|
||||||
}
|
|
||||||
|
|
||||||
func gforward(i interface{}) {
|
|
||||||
rc := i.(*RelayConn)
|
|
||||||
defer rc.dst.Close()
|
|
||||||
defer rc.src.Close()
|
|
||||||
CopyPileline(rc.dst, rc.src, rc.destAddrPort)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Socks5Relay(client, target net.Conn, destAddrPort string) {
|
|
||||||
rc := &RelayConn{
|
|
||||||
src: client,
|
|
||||||
dst: target,
|
|
||||||
destAddrPort: destAddrPort,
|
|
||||||
}
|
|
||||||
logrus.Debug(fmt.Sprintf("dpool: %d left: %d, gpool: %d left: %d", dpool.Running(), dpool.Free(), gpool.Running(), gpool.Free()))
|
|
||||||
dpool.Invoke(rc)
|
|
||||||
if cache.Contains(destAddrPort) {
|
|
||||||
logrus.Debug(fmt.Sprintf("Hit LRU Relay Cache: %s", destAddrPort))
|
|
||||||
rc.src, rc.dst = rc.dst, rc.src
|
|
||||||
dpool.Invoke(rc)
|
|
||||||
} else {
|
|
||||||
gpool.Invoke(rc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func Socks5Forward(client, target net.Conn, destAddrPort string) {
|
func Socks5Forward(client, target net.Conn, destAddrPort string) {
|
||||||
forward := func(src, dest net.Conn) {
|
forward := func(src, dest net.Conn) {
|
||||||
defer src.Close()
|
defer src.Close()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user