2023-07-26 21:59:42 +01:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
package magicsock
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/netip"
|
|
|
|
|
2024-08-06 17:00:28 +01:00
|
|
|
"golang.org/x/net/ipv4"
|
2023-07-26 21:59:42 +01:00
|
|
|
"golang.org/x/net/ipv6"
|
|
|
|
"tailscale.com/types/nettype"
|
|
|
|
)
|
|
|
|
|
2024-08-06 17:00:28 +01:00
|
|
|
var (
|
|
|
|
// This acts as a compile-time check for our usage of ipv6.Message in
|
|
|
|
// batchingConn for both IPv6 and IPv4 operations.
|
|
|
|
_ ipv6.Message = ipv4.Message{}
|
2023-07-26 21:59:42 +01:00
|
|
|
)
|
|
|
|
|
2024-08-06 17:00:28 +01:00
|
|
|
// batchingConn is a nettype.PacketConn that provides batched i/o.
|
|
|
|
type batchingConn interface {
|
|
|
|
nettype.PacketConn
|
|
|
|
ReadBatch(msgs []ipv6.Message, flags int) (n int, err error)
|
|
|
|
WriteBatchTo(buffs [][]byte, addr netip.AddrPort) error
|
2023-09-18 19:23:27 +01:00
|
|
|
}
|