Documentation
¶
Overview ¶
Package destblock refuses connections by the name of their destination, for the node's shared egress.
A list of domain suffixes decides. A destination given by name is matched directly (List.Match). A destination given by IP address carries its name only in the first bytes the client sends: the SNI of a TLS ClientHello (WrapTCP) or of a QUIC Initial (QUICGuard). Nothing else is looked at: a stream that is not TLS, a hello without a name (ECH) and a stream that does not show its name within maxSniff bytes pass untouched.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapTCP ¶
WrapTCP holds the client's first bytes of a connection to an IP address until the TLS ClientHello is complete. A name in list closes the connection (onBlock is called once) and no held byte reaches the server. Anything else, a stream that does not start with TLS first, is written out as it came, in order, and every later byte goes straight through.
Write has one caller at a time (the copy loop of the protocol, after the sniffer's put-back bytes), as in torrentguard. Close and CloseWrite may come from other goroutines; the lock is never held over a network write.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is an immutable set of domain suffixes. A nil or empty list blocks nothing.
type QUICGuard ¶
type QUICGuard struct {
// contains filtered or unexported fields
}
QUICGuard reads the name from the first datagrams a client sends to each IP destination. One guard serves one UDP session (a session may name several destinations). Safe for concurrent use.
func (*QUICGuard) Drop ¶
Drop reports whether the datagram b, the next one for host:port, must not be sent: the QUIC Initial in it (with the ones before it) names something in list, or an earlier datagram of the flow did. A flow whose first datagram is not a QUIC Initial is never looked at again. A ClientHello in two datagrams lets the first one out: without the second the server cannot read it.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dbtest makes first flights for tests of destblock and its callers: a real TLS ClientHello and the UDP datagrams of a real QUIC client, produced by crypto/tls and quic-go in memory, no network.
|
Package dbtest makes first flights for tests of destblock and its callers: a real TLS ClientHello and the UDP datagrams of a real QUIC client, produced by crypto/tls and quic-go in memory, no network. |