pool => go2pool

This commit is contained in:
kony
2025-09-23 09:35:29 +08:00
parent ec603bf2b8
commit 28d01fac12
4 changed files with 14 additions and 14 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)
}

View File

@@ -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("开启代理模式")