Update WireGuard and Tailscale

This commit is contained in:
世界
2025-09-15 19:52:28 +08:00
parent 12b055989b
commit 7f3ea8dbd8
8 changed files with 21 additions and 40 deletions

View File

@@ -162,7 +162,7 @@ func (c *ClientBind) SetMark(mark uint32) error {
return nil
}
func (c *ClientBind) Send(bufs [][]byte, ep conn.Endpoint) error {
func (c *ClientBind) Send(bufs [][]byte, ep conn.Endpoint, offset int) error {
udpConn, err := c.connect()
if err != nil {
c.pauseManager.WaitActive()
@@ -170,15 +170,18 @@ func (c *ClientBind) Send(bufs [][]byte, ep conn.Endpoint) error {
return err
}
destination := netip.AddrPort(ep.(remoteEndpoint))
for _, b := range bufs {
if len(b) > 3 {
for _, buf := range bufs {
if offset > 0 {
buf = buf[offset:]
}
if len(buf) > 3 {
reserved, loaded := c.reservedForEndpoint[destination]
if !loaded {
reserved = c.reserved
}
copy(b[1:4], reserved[:])
copy(buf[1:4], reserved[:])
}
_, err = udpConn.WriteToUDPAddrPort(b, destination)
_, err = udpConn.WriteToUDPAddrPort(buf, destination)
if err != nil {
udpConn.Close()
return err