mirror of
https://github.com/hackdiaz-dev/free-turn-proxy.git
synced 2026-10-12 09:41:53 +02:00
perf(netconn): адрес пайпа без аллокации на каждое чтение
This commit is contained in:
@@ -35,15 +35,15 @@ func PacketPipe(mtu, queue int) (net.PacketConn, net.PacketConn) {
|
||||
toA := make(chan *[]byte, queue)
|
||||
toB := make(chan *[]byte, queue)
|
||||
|
||||
a := &packetPipe{local: "pipe:a", remote: "pipe:b", rx: toA, tx: toB, mtu: mtu, pool: pool, done: make(chan struct{})}
|
||||
b := &packetPipe{local: "pipe:b", remote: "pipe:a", rx: toB, tx: toA, mtu: mtu, pool: pool, done: make(chan struct{})}
|
||||
a := &packetPipe{local: pipeAddr("pipe:a"), remote: pipeAddr("pipe:b"), rx: toA, tx: toB, mtu: mtu, pool: pool, done: make(chan struct{})}
|
||||
b := &packetPipe{local: pipeAddr("pipe:b"), remote: pipeAddr("pipe:a"), rx: toB, tx: toA, mtu: mtu, pool: pool, done: make(chan struct{})}
|
||||
a.peer, b.peer = b, a
|
||||
return a, b
|
||||
}
|
||||
|
||||
type packetPipe struct {
|
||||
local pipeAddr
|
||||
remote pipeAddr
|
||||
local net.Addr
|
||||
remote net.Addr
|
||||
rx <-chan *[]byte
|
||||
tx chan<- *[]byte
|
||||
peer *packetPipe
|
||||
|
||||
Reference in New Issue
Block a user