Versions in this module Expand all Collapse all v0 v0.0.2 Apr 17, 2024 v0.0.1 Apr 11, 2023 Changes in this version + 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 ErrServerConfig + const ErrServerNotStarted + const ErrTooShort + func HexDecodeKey(str string) ([]byte, error) + func HexEncodeKey(b []byte) string + type Cert struct + ClientMagic [clientMagicSize]byte + EsVersion CryptoConstruction + NotAfter uint32 + NotBefore uint32 + ResolverPk [keySize]byte + ResolverSk [keySize]byte + Serial uint32 + Signature [ed25519.SignatureSize]byte + func (c *Cert) Deserialize(b []byte) error + func (c *Cert) Serialize() ([]byte, error) + func (c *Cert) Sign(privateKey ed25519.PrivateKey) + func (c *Cert) String() string + func (c *Cert) VerifyDate() bool + func (c *Cert) VerifySignature(publicKey ed25519.PublicKey) bool + type Client struct + Net string + Timeout time.Duration + UDPSize int + func (c *Client) Dial(stampStr string) (*ResolverInfo, error) + func (c *Client) DialStamp(stamp dnsstamps.ServerStamp) (*ResolverInfo, error) + func (c *Client) Exchange(m *dns.Msg, resolverInfo *ResolverInfo) (resp *dns.Msg, err error) + func (c *Client) ExchangeConn(conn net.Conn, m *dns.Msg, resolverInfo *ResolverInfo) (*dns.Msg, error) + type CryptoConstruction uint16 + const UndefinedConstruction + const XChacha20Poly1305 + const XSalsa20Poly1305 + func (c CryptoConstruction) String() string + type EncryptedQuery struct + ClientMagic [clientMagicSize]byte + ClientPk [keySize]byte + EsVersion CryptoConstruction + Nonce [nonceSize]byte + func (q *EncryptedQuery) Decrypt(query []byte, serverSecretKey [keySize]byte) ([]byte, error) + func (q *EncryptedQuery) Encrypt(packet []byte, sharedKey [sharedKeySize]byte) ([]byte, error) + type EncryptedResponse struct + EsVersion CryptoConstruction + Nonce [nonceSize]byte + func (r *EncryptedResponse) Decrypt(response []byte, sharedKey [sharedKeySize]byte) ([]byte, error) + func (r *EncryptedResponse) Encrypt(packet []byte, sharedKey [sharedKeySize]byte) ([]byte, error) + type Error string + func (e Error) Error() string + type Handler interface + ServeDNS func(rw ResponseWriter, r *dns.Msg) error + var DefaultHandler Handler = &defaultHandler{ ... } + 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) (ResolverConfig, error) + func (rc *ResolverConfig) CreateCert() (*Cert, error) + func (rc *ResolverConfig) CreateStamp(addr string) (dnsstamps.ServerStamp, error) + type ResolverInfo struct + ProviderName string + PublicKey [keySize]byte + ResolverCert *Cert + SecretKey [keySize]byte + ServerAddress string + ServerPublicKey ed25519.PublicKey + SharedKey [keySize]byte + type ResponseWriter interface + LocalAddr func() net.Addr + RemoteAddr func() net.Addr + WriteMsg func(m *dns.Msg) error + type Server struct + Handler Handler + ProviderName string + ResolverCert *Cert + UDPSize int + func (s *Server) ServeTCP(l net.Listener) error + func (s *Server) ServeUDP(l *net.UDPConn) error + func (s *Server) Shutdown(ctx context.Context) error + type ServerDNSCrypt interface + ServeTCP func(l net.Listener) error + ServeUDP func(l *net.UDPConn) error + Shutdown func(ctx context.Context) error + type TCPResponseWriter struct + func (w *TCPResponseWriter) LocalAddr() net.Addr + func (w *TCPResponseWriter) RemoteAddr() net.Addr + func (w *TCPResponseWriter) WriteMsg(m *dns.Msg) error + type UDPResponseWriter struct + func (w *UDPResponseWriter) LocalAddr() net.Addr + func (w *UDPResponseWriter) RemoteAddr() net.Addr + func (w *UDPResponseWriter) WriteMsg(m *dns.Msg) error