proxy

package
v0.1.106 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CloudflareProvider provider = iota
	DNSPodProvider
	GoogleProvider
	Quad9Provider
)

DoH Providers enum

Variables

View Source
var (
	ResponseTypeA    = 1
	ResponseTypeAAAA = 28
)

Supported dns response types

View Source
var (

	// Proxy ...
	Proxy = goproxy.NewProxyHttpServer()

	// ProxyPort ...
	ProxyPort = 65222
)
View Source
var AlwaysHTTPMitm goproxy.FuncHttpsHandler = func(host string, ctx *goproxy.ProxyCtx) (*goproxy.ConnectAction, string) {
	return &goproxy.ConnectAction{Action: goproxy.ConnectMitm, TLSConfig: CustomTLS(&goproxy.GoproxyCa)}, host
}

AlwaysHTTPMitm ...

DoH Providers list

Functions

func CustomDialContext

func CustomDialContext(ctx context.Context, network, addr string) (net.Conn, error)

CustomDialContext ...

func CustomTLS

func CustomTLS(ca *tls.Certificate) func(host string, ctx *goproxy.ProxyCtx) (*tls.Config, error)

CustomTLS ...

func GetClient

func GetClient() *http.Client

GetClient ...

func GetDirectClient

func GetDirectClient() *http.Client

GetDirectClient ...

func IPs added in v0.1.103

func IPs(resp *dns.Response) []string

func Reload

func Reload()

Reload ...

func TTL added in v0.1.103

func TTL(resp *dns.Response) int

Types

type CustomProxy

type CustomProxy struct {
	Server    *http.Server
	IsErrored bool
}

CustomProxy stores http.Server with field showing there was an error while listening.

func StartProxy

func StartProxy() *CustomProxy

StartProxy starts HTTP/HTTPS proxy for debugging

type DoH added in v0.1.103

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

DoH is doh client

func UseProviders added in v0.1.103

func UseProviders(provider ...provider) *DoH

func (*DoH) Close added in v0.1.103

func (c *DoH) Close()

Close close doh client

func (*DoH) Query added in v0.1.103

func (c *DoH) Query(ctx context.Context, d dns.Domain, t dns.Type, s ...dns.ECS) (*dns.Response, error)

Query do DoH query

type Provider added in v0.1.103

type Provider interface {
	Query(context.Context, dns.Domain, dns.Type, ...dns.ECS) (*dns.Response, error)
	String() string
}

Provider is the provider interface

func New added in v0.1.103

func New(provider provider) Provider

New returns a new DoH client, quad9 is default

Jump to

Keyboard shortcuts

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