diff --git a/netstack/forward_tcp.go b/netstack/forward_tcp.go index 1052f60..2961397 100644 --- a/netstack/forward_tcp.go +++ b/netstack/forward_tcp.go @@ -3,7 +3,7 @@ package netstack import ( "context" "encoding/binary" - pool2 "go2/pool" + go2pool "go2/pool" "goodlink/proxy" "log" @@ -28,8 +28,8 @@ func ForwardTCPConn(originConn *TcpConn, stun_quic_conn quic.Connection) { ipv4Bytes := originConn.ID().LocalAddress.As4() new_quic_stream.Write(ipv4Bytes[:]) // 添加[:]转换为切片 - portBytes := pool2.Malloc(2) - defer pool2.Free(portBytes) + portBytes := go2pool.Malloc(2) + defer go2pool.Free(portBytes) binary.BigEndian.PutUint16(portBytes, originConn.ID().LocalPort) new_quic_stream.Write(portBytes) diff --git a/netstack/forward_udp.go b/netstack/forward_udp.go index cff4c04..21aad10 100644 --- a/netstack/forward_udp.go +++ b/netstack/forward_udp.go @@ -3,7 +3,7 @@ package netstack import ( "context" "encoding/binary" - pool2 "go2/pool" + go2pool "go2/pool" "goodlink/proxy" "log" @@ -27,8 +27,8 @@ func ForwardUdpConn(originConn *udpConn, stun_quic_conn quic.Connection) { ipv4Bytes := originConn.ID().LocalAddress.As4() new_quic_stream.Write(ipv4Bytes[:]) // 添加[:]转换为切片 - portBytes := pool2.Malloc(2) - defer pool2.Free(portBytes) + portBytes := go2pool.Malloc(2) + defer go2pool.Free(portBytes) binary.BigEndian.PutUint16(portBytes, originConn.ID().LocalPort) new_quic_stream.Write(portBytes) diff --git a/proxy/proxy_io.go b/proxy/proxy_io.go index a8b57a8..42985ad 100644 --- a/proxy/proxy_io.go +++ b/proxy/proxy_io.go @@ -1,7 +1,7 @@ package proxy import ( - pool2 "go2/pool" + go2pool "go2/pool" "io" "net" @@ -14,8 +14,8 @@ func ForwardT2Q(tc net.Conn, qc quic.Stream, stun_quic_conn quic.Connection) { tc.Close() }() - buf := pool2.Malloc(32 * 1024) // 32KB缓冲区提升吞吐量 - defer pool2.Free(buf) + buf := go2pool.Malloc(32 * 1024) // 32KB缓冲区提升吞吐量 + defer go2pool.Free(buf) io.CopyBuffer(tc, qc, buf) } @@ -25,7 +25,7 @@ func ForwardQ2T(qc quic.Stream, tc net.Conn, stun_quic_conn quic.Connection) { tc.Close() }() - buf := pool2.Malloc(32 * 1024) // 32KB缓冲区提升吞吐量 - defer pool2.Free(buf) + buf := go2pool.Malloc(32 * 1024) // 32KB缓冲区提升吞吐量 + defer go2pool.Free(buf) io.CopyBuffer(qc, tc, buf) } diff --git a/proxy/proxy_r.go b/proxy/proxy_r.go index d4171a5..afa6a53 100644 --- a/proxy/proxy_r.go +++ b/proxy/proxy_r.go @@ -4,7 +4,7 @@ import ( "context" "encoding/binary" "go2/log" - pool2 "go2/pool" + go2pool "go2/pool" "io" "net" proxy_handle "proxy/handle" @@ -14,8 +14,8 @@ import ( func ProcessProxyServer(stun_quic_conn quic.Connection) { head_len := 7 // 1字节传输协议类型 + 4字节IPv4地址 + 2字节端口号 - buf := pool2.Malloc(head_len) - defer pool2.Free(buf) + buf := go2pool.Malloc(head_len) + defer go2pool.Free(buf) proxy_handle.Init() log.Info("开启代理模式")