dohproxy

package module
v0.0.0-...-a997279 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 22 Imported by: 0

README

dohproxy

DNS-over-HTTPS proxy

Documentation

Index

Constants

View Source
const (
	// REALM defines the OAuth2 authentication realm.
	REALM = "DNS-over-HTTPS Proxy"
	// TENANT defines the OAuth2 authentication tenant.
	TENANT = "DNS-over-HTTPS-proxy"
)
View Source
const (
	// NonceLen defines the nonce length in bytes.
	NonceLen = 12
)

Variables

View Source
var (
	// ErrorInvalidKeyPair defines an error when envelope is encrypted
	// with an unknown key pair.
	ErrorInvalidKeyPair = errors.New("invalid key pair")
)

Functions

func Certificate

func Certificate(w http.ResponseWriter, r *http.Request)

Certificate returns the proxy's authentication certificate.

func DNSQuery

func DNSQuery(w http.ResponseWriter, r *http.Request)

DNSQuery implements handler for DNS queries.

func Decrypt

func Decrypt(key, data []byte) ([]byte, error)

Decrypt decrypts the data with the key.

func DoHProxy

func DoHProxy(w http.ResponseWriter, r *http.Request)

DoHProxy implements the Google Cloud Functions entrypoint.

func Encrypt

func Encrypt(key, data []byte) ([]byte, error)

Encrypt encrypts the data with the key.

func Errorf

func Errorf(w http.ResponseWriter, code int, format string, a ...interface{})

Errorf returns an HTTP error.

func Fatalf

func Fatalf(format string, a ...interface{})

Fatalf prints a fatal error and exits the program.

func SAs

func SAs(w http.ResponseWriter, r *http.Request)

SAs handles security association creation and encrypted DNS queries.

Types

type CreateSA

type CreateSA struct {
	SAs []*Envelope
}

CreateSA defines the attibutes for the security association creation request.

type Envelope

type Envelope struct {
	Data  []byte `json:"data"`
	KeyID string `json:"key_id"`
}

Envelope defines a data container.

func (*Envelope) Decrypt

func (env *Envelope) Decrypt(kp *KeyPair) ([]byte, error)

Decrypt decrypts the envelope with the key pair.

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

KeyPair defines a private key and certificate key pair.

func GetEphemeralKeyPair

func GetEphemeralKeyPair() (*KeyPair, error)

GetEphemeralKeyPair returns an ephemeral key pair.

type NewSARequest

type NewSARequest struct {
	ID  string `json:"id"`
	Key []byte `json:"key"`
}

NewSARequest defines the attributes of the new security association.

type ProxyRequest

type ProxyRequest struct {
	Data   []byte `json:"data"`
	Server string `json:"server"`
}

ProxyRequest defines the attributes for the DNS proxy request.

type SA

type SA struct {
	ID  string
	Key []byte
}

SA defines a security association.

Directories

Path Synopsis
apps
cmd

Jump to

Keyboard shortcuts

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