mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-16 19:49:56 +00:00
19 lines
753 B
Go
19 lines
753 B
Go
package dialer
|
|
|
|
// DatagramSized is implemented by dialers whose connections carry each write in
|
|
// a single datagram, so a write can be rejected when it exceeds the path's
|
|
// datagram budget (e.g. QUIC). Transports without this capability (e.g.
|
|
// WebSocket over TCP) impose no per-write size limit, so the relay client can
|
|
// fall back to them when a datagram-sized transport rejects a write as too
|
|
// large. The capability is advertised per dialer rather than hardcoded, so a
|
|
// new transport only needs to declare whether it is datagram-sized.
|
|
type DatagramSized interface {
|
|
DatagramSized()
|
|
}
|
|
|
|
// IsDatagramSized reports whether d produces datagram-sized connections.
|
|
func IsDatagramSized(d DialeFn) bool {
|
|
_, ok := d.(DatagramSized)
|
|
return ok
|
|
}
|