123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package dynamicproxy
- import (
- "net"
- "net/http"
- "sync"
- "imuslab.com/zoraxy/mod/dynamicproxy/dpcore"
- "imuslab.com/zoraxy/mod/dynamicproxy/redirection"
- "imuslab.com/zoraxy/mod/geodb"
- "imuslab.com/zoraxy/mod/statistic"
- "imuslab.com/zoraxy/mod/tlscert"
- )
- const (
- ProxyType_Subdomain = 0
- ProxyType_Vdir = 1
- )
- type ProxyHandler struct {
- Parent *Router
- }
- type RouterOption struct {
- HostUUID string
- Port int
- UseTls bool
- ForceHttpsRedirect bool
- TlsManager *tlscert.Manager
- RedirectRuleTable *redirection.RuleTable
- GeodbStore *geodb.Store
- StatisticCollector *statistic.Collector
- }
- type Router struct {
- Option *RouterOption
- ProxyEndpoints *sync.Map
- SubdomainEndpoint *sync.Map
- Running bool
- Root *ProxyEndpoint
- mux http.Handler
- server *http.Server
- tlsListener net.Listener
- routingRules []*RoutingRule
- tlsRedirectStop chan bool
- }
- type BasicAuthCredentials struct {
- Username string
- PasswordHash string
- }
- type BasicAuthUnhashedCredentials struct {
- Username string
- Password string
- }
- type ProxyEndpoint struct {
- ProxyType int
- RootOrMatchingDomain string
- Domain string
- RequireTLS bool
- SkipCertValidations bool
- RequireBasicAuth bool
- BasicAuthCredentials []*BasicAuthCredentials `json:"-"`
- Proxy *dpcore.ReverseProxy `json:"-"`
- }
- type RootOptions struct {
- ProxyLocation string
- RequireTLS bool
- SkipCertValidations bool
- RequireBasicAuth bool
- BasicAuthCredentials []*BasicAuthCredentials
- }
- type VdirOptions struct {
- RootName string
- Domain string
- RequireTLS bool
- SkipCertValidations bool
- RequireBasicAuth bool
- BasicAuthCredentials []*BasicAuthCredentials
- }
- type SubdOptions struct {
- MatchingDomain string
- Domain string
- RequireTLS bool
- SkipCertValidations bool
- RequireBasicAuth bool
- BasicAuthCredentials []*BasicAuthCredentials
- }
|