dnstruncate

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package dnstruncate functions as an alternative implementation that handles DNS requests if the remote server doesn't support UDP traffic. This is done by always setting the TC (truncated) bit in the DNS response header; it tells the caller to resend the DNS request using TCP instead of UDP. As a result, no UDP requests are made to the remote server.

This implementation is ported from the go-tun2socks' dnsfallback.NewUDPHandler.

Note that UDP traffic that are not DNS requests are dropped.

To create a network.PacketProxy that handles DNS requests locally:

proxy, err := dnstruncate.NewPacketProxy()
if err != nil {
	// handle error
}

This `proxy` can then be used in, for example, lwip2transport.ConfigureDevice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPacketProxy

func NewPacketProxy() (network.PacketProxy, error)

NewPacketProxy creates a new network.PacketProxy that can be used to handle DNS requests if the remote proxy doesn't support UDP traffic. It sets the TC (truncated) bit in the DNS response header to tell the caller to resend the DNS request over TCP.

This network.PacketProxy should only be used if the remote proxy server doesn't support UDP traffic at all. Note that all other non-DNS UDP packets will be dropped by this network.PacketProxy.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL