mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-07 04:20:12 +02:00
c6b211ef9b
- Add default cloudflare and google tls ipv6 servers to default tcp servers - update integration test to try against both ipv4 and ipv6 servers
22 lines
769 B
Go
22 lines
769 B
Go
package tcp
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
// setMark sets a mark on each packets sent through this socket.
|
|
// This is used in conjunction with iptables to block outgoing kernel automated
|
|
// RST packets, since the kernel is not aware of us handling the connection manually.
|
|
// For example:
|
|
// iptables -A OUTPUT -p tcp --tcp-flags RST RST -m mark ! --mark 123 -j DROP
|
|
//
|
|
//nolint:dupword
|
|
func setMark(fd, excludeMark int) error {
|
|
return unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_MARK, excludeMark)
|
|
}
|
|
|
|
func setMTUDiscovery(fd int, ipv4 bool) error {
|
|
if ipv4 {
|
|
return unix.SetsockoptInt(fd, unix.IPPROTO_IP, unix.IP_MTU_DISCOVER, unix.IP_PMTUDISC_PROBE)
|
|
}
|
|
return unix.SetsockoptInt(fd, unix.IPPROTO_IPV6, unix.IPV6_MTU_DISCOVER, unix.IPV6_PMTUDISC_PROBE)
|
|
}
|