mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-30 16:26:36 +08:00
18 lines
281 B
Go
18 lines
281 B
Go
package proxyproto
|
|
|
|
import (
|
|
"net"
|
|
|
|
proxyproto "github.com/pires/go-proxyproto"
|
|
)
|
|
|
|
func WrapClientConn(ppv int, src, dst net.Addr, c net.Conn) net.Conn {
|
|
if ppv <= 0 {
|
|
return c
|
|
}
|
|
|
|
header := proxyproto.HeaderProxyFromAddrs(byte(ppv), src, dst)
|
|
header.WriteTo(c)
|
|
return c
|
|
}
|