Documentation
¶
Index ¶
- Constants
- Variables
- func CustomDialContext(ctx context.Context, network, addr string) (net.Conn, error)
- func CustomTLS(ca *tls.Certificate) func(host string, ctx *goproxy.ProxyCtx) (*tls.Config, error)
- func GetClient() *http.Client
- func GetDirectClient() *http.Client
- func GetProxyClient() *http.Client
- func IPs(ips []net.IPAddr) []string
- func NewDNSProvider(provider string) (uri string, p *net.Resolver, err error)
- func NewDoHProvider(provider dohprovider) (uri string, p *net.Resolver, err error)
- func Reload()
- func StartRecording(tag string)
- func StopProxy()
- type AntizapretConfig
- type AntizapretProxy
- type CustomDNS
- type CustomDNSProvider
- type CustomProxy
- type DomainEntry
- type LengthEntry
- type PatternEntry
- type Provider
- type RecordedRequest
- type SpecialEntry
Constants ¶
const ( AllProviders dohprovider = iota CloudflareProvider GoogleProvider Quad9Provider OpenNameServerProvider CustomProvider )
CustomDNS Providers enum
const CACHE_TTL = 24 * time.Hour // 24 hour caching
const CONFIG_FILE_NAME = "antizapret_config.gob" // Using gob for caching
const HASH_MASK = (1 << TABLE_LEN_BITS) - 1
const TABLE_LEN_BITS = 18
variables for unlzp function
const USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"
Variables ¶
var ( // Proxy ... Proxy = goproxy.NewProxyHttpServer() // ProxyPort ... ProxyPort = 65222 )
var AlwaysHTTPMitm goproxy.FuncHttpsHandler = func(host string, ctx *goproxy.ProxyCtx) (*goproxy.ConnectAction, string) { ctx.UserData = proxyUser(ctx.Req) return &goproxy.ConnectAction{Action: goproxy.ConnectMitm, TLSConfig: CustomTLS(&goproxy.GoproxyCa)}, host }
AlwaysHTTPMitm ...
var CACHE_DIR = ""
var ( DoHProviders = []dohprovider{ CloudflareProvider, GoogleProvider, Quad9Provider, OpenNameServerProvider, } )
Default DoH Providers list
Functions ¶
func CustomDialContext ¶
CustomDialContext ...
func GetProxyClient ¶ added in v0.1.119
GetProxyClient returns the client sending requests through the internal proxy whenever it is enabled, like Burst requests, so they get the same browser fingerprint.
func NewDNSProvider ¶ added in v0.1.114
NewDNSProvider returns a new DNS client, local resolv is default
func NewDoHProvider ¶ added in v0.1.114
NewDoHProvider returns a new DoH client, quad9 is default
func Reload ¶
func Reload()
Reload applies proxy configuration: DNS resolvers, the direct client upstream proxy and the internal proxy server lifecycle.
func StartRecording ¶ added in v0.1.119
func StartRecording(tag string)
StartRecording records requests, made with "tag" as proxy user name, like http://tag:@127.0.0.1:65222
Types ¶
type AntizapretConfig ¶ added in v0.1.112
type AntizapretConfig struct {
CreatedAt time.Time
Domains []DomainEntry // Use slice to preserve order of TLD
Special []SpecialEntry // Use slice to preserve order
DIpaddr []uint32 // IP addresses stored as big-endian uint32
PatternsDomainsLzp []PatternEntry // Use slice to preserve order
PatternsMaskLzp []PatternEntry // Use slice to preserve order
ThreePartSuffixesPattern string
ProxyURL string
}
type AntizapretProxy ¶ added in v0.1.112
type AntizapretProxy struct {
// contains filtered or unexported fields
}
AntizapretProxy struct
func NewAntizapretProxy ¶ added in v0.1.112
func NewAntizapretProxy() *AntizapretProxy
Constructor for AntizapretProxy
func (*AntizapretProxy) Detect ¶ added in v0.1.112
func (ap *AntizapretProxy) Detect(host string) string
Detect if a host needs proxying Returns the proxy URL string if proxy is needed, otherwise returns an empty string.
func (*AntizapretProxy) Update ¶ added in v0.1.112
func (ap *AntizapretProxy) Update()
type CustomDNS ¶ added in v0.1.114
type CustomDNS struct {
// contains filtered or unexported fields
}
CustomDNS is custom DNS client
func UseDNSProviders ¶ added in v0.1.114
func UseDoHProviders ¶ added in v0.1.114
func UseDoHProviders(provider ...dohprovider) *CustomDNS
type CustomDNSProvider ¶ added in v0.1.114
type CustomProxy ¶
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. Repeated calls return the proxy that is already running.
type DomainEntry ¶ added in v0.1.112
type DomainEntry struct {
TLD string
Lengths []LengthEntry // Use slice to preserve order
}
type LengthEntry ¶ added in v0.1.112
type PatternEntry ¶ added in v0.1.112
Structs to hold the configuration data
type RecordedRequest ¶ added in v0.1.119
RecordedRequest is a request, that went through internal proxy with a recorded tag
func StopRecording ¶ added in v0.1.119
func StopRecording(tag string) []RecordedRequest
StopRecording returns requests recorded for the tag