Versions in this module Expand all Collapse all v0 v0.0.2 Jul 2, 2026 Changes in this version + const ErrUnexpectedNonce + type HandlerFunc func(ctx context.Context, rw ResponseWriter, r *dns.Msg) (err error) + func (f HandlerFunc) ServeDNS(ctx context.Context, rw ResponseWriter, r *dns.Msg) (err error) v0.0.1 Jun 15, 2026 Changes in this version + const DNSCryptV2Prefix + const ErrCertMagic + const ErrCertTooShort + const ErrESVersion + const ErrFailedToFetchCert + const ErrInvalidCertSignature + const ErrInvalidClientMagic + const ErrInvalidDNSStamp + const ErrInvalidDate + const ErrInvalidPadding + const ErrInvalidQuery + const ErrInvalidResolverMagic + const ErrInvalidResponse + const ErrQueryTooLarge + const ErrServerAlreadyStarted + const ErrServerConfig + const ErrServerNotStarted + const ErrTooShort + const KeySize + const SharedKeySize + func HexDecodeKey(str string) (decoded []byte, err error) + func HexEncodeKey(b []byte) (encoded string) + type Certificate struct + ClientMagic [clientMagicSize]byte + ESVersion CryptoConstruction + NotAfter uint32 + NotBefore uint32 + ResolverPk [KeySize]byte + ResolverSk [KeySize]byte + Serial uint32 + Signature [ed25519.SignatureSize]byte + func (c *Certificate) MarshalBinary() (serialized []byte, err error) + func (c *Certificate) Sign(privateKey ed25519.PrivateKey) + func (c *Certificate) String() (s string) + func (c *Certificate) UnmarshalBinary(b []byte) (err error) + func (c *Certificate) Validate() (err error) + func (c *Certificate) VerifyDate() (ok bool) + func (c *Certificate) VerifySignature(publicKey ed25519.PublicKey) (ok bool) + type Client struct + func NewClient(conf *ClientConfig) (c *Client) + func (c *Client) DialContext(ctx context.Context, stampStr string) (info *ResolverInfo, err error) + func (c *Client) DialStampContext(ctx context.Context, stamp dnsstamps.ServerStamp) (info *ResolverInfo, err error) + func (c *Client) ExchangeConnContext(ctx context.Context, conn net.Conn, m *dns.Msg, info *ResolverInfo) (resp *dns.Msg, err error) + func (c *Client) ExchangeContext(ctx context.Context, m *dns.Msg, info *ResolverInfo) (resp *dns.Msg, err error) + type ClientConfig struct + Logger *slog.Logger + Proto Proto + UDPSize int + type CryptoConstruction uint16 + const UndefinedConstruction + const XChacha20Poly1305 + const XSalsa20Poly1305 + func (c CryptoConstruction) String() (construction string) + type Handler interface + ServeDNS func(ctx context.Context, rw ResponseWriter, r *dns.Msg) (err error) + type Proto string + const ProtoTCP + const ProtoUDP + func ProtoFromString(s string) (p Proto, err error) + func (p Proto) Validate() (err error) + type ResolverConfig struct + CertificateTTL time.Duration + ESVersion CryptoConstruction + PrivateKey string + ProviderName string + PublicKey string + ResolverPk string + ResolverSk string + func GenerateResolverConfig(providerName string, privateKey ed25519.PrivateKey, ttl time.Duration) (rc ResolverConfig, err error) + func (rc *ResolverConfig) CreateStamp(addr string) (stamp dnsstamps.ServerStamp, err error) + func (rc *ResolverConfig) NewCert() (cert *Certificate, err error) + func (rc *ResolverConfig) Validate() (err error) + type ResolverInfo struct + ProviderName string + PublicKey [KeySize]byte + ResolverCert *Certificate + SecretKey [KeySize]byte + ServerAddress string + ServerPublicKey ed25519.PublicKey + SharedKey [KeySize]byte + type ResponseWriter interface + LocalAddr func() (addr net.Addr) + RemoteAddr func() (addr net.Addr) + WriteMsg func(ctx context.Context, m *dns.Msg) (err error) + type Server struct + func NewServer(conf *ServerConfig) (s *Server, err error) + func (s *Server) LocalAddr() (addr net.Addr) + func (s *Server) Shutdown(ctx context.Context) (err error) + func (s *Server) Start(ctx context.Context) (err error) + type ServerConfig struct + Addr netip.AddrPort + Handler Handler + Logger *slog.Logger + Proto Proto + ProviderName string + ResolverCert *Certificate + UDPSize uint + func (c *ServerConfig) Validate() (err error)