dnscrypt

package
v0.0.0-...-ea10d50 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MPL-2.0 Imports: 32 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// NonceSize is what the name suggests
	NonceSize = 24
	// TagSize is what the name suggests
	TagSize = 16
	// HalfNonceSize is half of NonceSize
	HalfNonceSize = NonceSize / 2
	// PublicKeySize is the size of a public key
	PublicKeySize = 32
	// QueryOverhead is the amount of request overhead due to client-magic, public key, nonce, and tag
	QueryOverhead = xdns.ClientMagicLen + PublicKeySize + HalfNonceSize + TagSize
	// ResponseOverhead is the amount of answer overhead due to server-magic, nonce, and tag
	ResponseOverhead = len(xdns.ServerMagic) + NonceSize + TagSize
)
View Source
const (
	ActionNone     = iota // No action has been taken
	ActionContinue        // Continue with the request
	ActionDrop            // Drop the request
	ActionSynth           // Use synthesized response
)
View Source
const (
	ReturnCodePass = iota
	ReturnCodeSynth
)

Variables

This section is empty.

Functions

func AddRelayTransport

func AddRelayTransport(p *DcMulti, relaystamp string) error

AddRelayTransport creates and adds a relay server to p

func AddTransport

func AddTransport(p *DcMulti, id, serverstamp string) (*severbyid, error)

AddTransport creates and adds a dnscrypt transport to p

func NewTransport

func NewTransport(p *DcMulti, id, rawstamp string) (dnsx.Transport, error)

NewTransport creates a free-standing (unregistered) DNSCrypt transport for id from rawstamp (a sdns:// stamp), dialing via p's proxies. The returned transport is not registered with p nor tracked by any resolver, and its certificate is not refreshed; it is expected to be short-lived (as long as the fetched certificate remains valid).

Types

type DcMulti

type DcMulti struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DcMulti is a dnsx.TransportMult supporting dnscrypt servers and relays

func NewDcMult

func NewDcMult(pctx context.Context, px ipn.ProxyProvider) *DcMulti

NewDcMult creates a dnscrypt proxy

func (*DcMulti) Add

func (proxy *DcMulti) Add(t x.DNSTransport) bool

Add implements dnsx.TransportMult

func (*DcMulti) AddAll

func (proxy *DcMulti) AddAll(serverscsv string) (int, error)

AddAll registers additional dnscrypt servers

func (*DcMulti) AddGateways

func (proxy *DcMulti) AddGateways(routescsv string) (int, error)

AddGateways adds relay servers

func (*DcMulti) Get

func (proxy *DcMulti) Get(id string) (x.DNSTransport, error)

Get implements dnsx.TransportMult

func (*DcMulti) GetAddr

func (p *DcMulti) GetAddr() string

GetAddr returns the last server address

func (*DcMulti) GetIPs

func (p *DcMulti) GetIPs(id string) string

func (*DcMulti) GetInternal

func (proxy *DcMulti) GetInternal(id string) (dnsx.Transport, error)

GetInternal implements dnsx.TransportMult

func (*DcMulti) GetRelay

func (p *DcMulti) GetRelay() x.Proxy

TODO: lastRelay?

func (*DcMulti) ID

func (p *DcMulti) ID() string

ID implements dnsx.TransportMult

func (*DcMulti) IPPorts

func (p *DcMulti) IPPorts() []netip.AddrPort

func (*DcMulti) LiveTransports

func (proxy *DcMulti) LiveTransports() string

LiveTransports returns csv of dnscrypt server-names currently in-use

func (*DcMulti) Measure

func (p *DcMulti) Measure(mid string, n, seconds int32) *x.DNSMeasurement

func (*DcMulti) OriginalAddr

func (p *DcMulti) OriginalAddr() string

func (*DcMulti) P50

func (p *DcMulti) P50() int64

P50 implements dnsx.TransportMult

func (*DcMulti) Query

func (p *DcMulti) Query(network string, q *dns.Msg, smm *x.DNSSummary) (r *dns.Msg, err error)

Query implements dnsx.TransportMult

func (*DcMulti) Refresh

func (proxy *DcMulti) Refresh() (string, error)

Refresh re-registers servers

func (*DcMulti) Relaying

func (t *DcMulti) Relaying() bool

TODO: lastRelayed?

func (*DcMulti) Remove

func (proxy *DcMulti) Remove(uid string) bool

Remove removes a dnscrypt server / relay, if any

func (*DcMulti) RemoveAll

func (proxy *DcMulti) RemoveAll(servernamescsv string) (int, error)

RemoveAll removes all dnscrypt servers in the csv

func (*DcMulti) RemoveGateways

func (proxy *DcMulti) RemoveGateways(routescsv string) (int, error)

RemoveGateways removes relay servers

func (*DcMulti) Status

func (p *DcMulti) Status() int32

Status implements dnsx.TransportMult

func (*DcMulti) Stop

func (proxy *DcMulti) Stop() error

Stop stops this dnscrypt proxy

func (*DcMulti) Type

func (p *DcMulti) Type() string

Type implements dnsx.TransportMult

type ServersInfo

type ServersInfo struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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