2023-07-26 20:59:42 +00:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
package magicsock
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/netip"
|
|
|
|
|
2024-08-06 16:00:28 +00:00
|
|
|
"golang.org/x/net/ipv4"
|
2023-07-26 20:59:42 +00:00
|
|
|
"golang.org/x/net/ipv6"
|
|
|
|
"tailscale.com/types/nettype"
|
|
|
|
)
|
|
|
|
|
2024-08-06 16:00:28 +00: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 20:59:42 +00:00
|
|
|
)
|
|
|
|
|
2024-08-06 16:00:28 +00: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 18:23:27 +00:00
|
|
|
}
|