Documentation
¶
Index ¶
- Constants
- func RegisterAPIFlags(flags []cli.Flag) []cli.Flag
- func RegisterClickHouseDBFlags(f []cli.Flag) []cli.Flag
- func RegisterClickHouseFlags(f []cli.Flag) []cli.Flag
- func RegisterCommonFlags(f []cli.Flag) []cli.Flag
- func RegisterEndpointsFlags(f []cli.Flag) []cli.Flag
- func RegisterServicesConfigFlags(flags []cli.Flag) []cli.Flag
- func RegisterWebFlags(f []cli.Flag) []cli.Flag
- type AccessHistory
- type Bucket
- type Claims
- type ClickHouse
- type ClickHouseDB
- type DBProvider
- type Distribution
- type EndpointsProvider
- type HTTPProxy
- type K8SClient
- type K8SEndpoints
- type Location
- type Mod
- type Ports
- type Resolver
- type ResponseWriterInterceptor
- func (w *ResponseWriterInterceptor) Flush()
- func (w *ResponseWriterInterceptor) GroupedStatusCode() int
- func (w *ResponseWriterInterceptor) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (w *ResponseWriterInterceptor) Write(p []byte) (int, error)
- func (w *ResponseWriterInterceptor) WriteHeader(statusCode int)
- type ServiceConfig
- type ServiceLocation
- type ServicesConfig
- type Source
- type SourceType
- type StandardClaims
- type StatRecord
- type ThrottledResponseWriter
- type URLParser
- type Web
Constants ¶
View Source
const (
ClickhouseDSNFlag = "clickhouse-dsn"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessHistory ¶
type AccessHistory struct {
// contains filtered or unexported fields
}
func NewAccessHistory ¶
func NewAccessHistory() *AccessHistory
type ClickHouse ¶
type ClickHouse struct {
// contains filtered or unexported fields
}
func NewClickHouse ¶
func NewClickHouse(c *cli.Context, db DBProvider) *ClickHouse
func (*ClickHouse) Add ¶
func (s *ClickHouse) Add(sr *StatRecord) error
func (*ClickHouse) Close ¶
func (s *ClickHouse) Close()
type ClickHouseDB ¶
type ClickHouseDB struct {
// contains filtered or unexported fields
}
func NewClickHouseDB ¶
func NewClickHouseDB(c *cli.Context) *ClickHouseDB
func (*ClickHouseDB) Close ¶
func (s *ClickHouseDB) Close()
type DBProvider ¶
type Distribution ¶
type Distribution string
const ( Hash Distribution = "Hash" NodeHash Distribution = "NodeHash" )
type EndpointsProvider ¶
type EndpointsProvider string
const ( Kubernetes EndpointsProvider = "Kubernetes" Environment EndpointsProvider = "Environment" )
type HTTPProxy ¶
type HTTPProxy struct { lazymap.LazyMap[*httputil.ReverseProxy] // contains filtered or unexported fields }
func NewHTTPProxy ¶
type K8SClient ¶
type K8SClient struct {
// contains filtered or unexported fields
}
func NewK8SClient ¶
func NewK8SClient() *K8SClient
type K8SEndpoints ¶
type K8SEndpoints struct { lazymap.LazyMap[*corev1.Endpoints] // contains filtered or unexported fields }
func NewEndpoints ¶
func NewEndpoints(c *cli.Context, cl *K8SClient) *K8SEndpoints
type Mod ¶
type Mod struct { Type string `json:"type"` Path string `json:"path"` Extra string `json:"extra"` Name string `json:"name"` }
Mod struct represents modification of source file.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver(cfg *ServicesConfig, svcLoc *ServiceLocation) *Resolver
type ResponseWriterInterceptor ¶
type ResponseWriterInterceptor struct { http.ResponseWriter // contains filtered or unexported fields }
func NewResponseWrtierInterceptor ¶
func NewResponseWrtierInterceptor(w http.ResponseWriter) *ResponseWriterInterceptor
func (*ResponseWriterInterceptor) Flush ¶
func (w *ResponseWriterInterceptor) Flush()
func (*ResponseWriterInterceptor) GroupedStatusCode ¶
func (w *ResponseWriterInterceptor) GroupedStatusCode() int
func (*ResponseWriterInterceptor) Hijack ¶
func (w *ResponseWriterInterceptor) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*ResponseWriterInterceptor) Write ¶
func (w *ResponseWriterInterceptor) Write(p []byte) (int, error)
func (*ResponseWriterInterceptor) WriteHeader ¶
func (w *ResponseWriterInterceptor) WriteHeader(statusCode int)
type ServiceConfig ¶
type ServiceConfig struct { Name string `yaml:"name"` Distribution Distribution `yaml:"distribution"` EndpointsProvider EndpointsProvider `yaml:"endpointsProvider"` PreferLocalNode bool `yaml:"preferLocalNode"` Headers map[string]string `yaml:"headers"` }
type ServiceLocation ¶
type ServiceLocation struct { lazymap.LazyMap[*Location] // contains filtered or unexported fields }
func NewServiceLocationPool ¶
func NewServiceLocationPool(c *cli.Context, ep *K8SEndpoints) *ServiceLocation
func (*ServiceLocation) Get ¶
func (s *ServiceLocation) Get(ctx context.Context, cfg *ServiceConfig, src *Source) (*Location, error)
type ServicesConfig ¶
type ServicesConfig map[string]*ServiceConfig
func LoadServicesConfigFromYAML ¶
func LoadServicesConfigFromYAML(c *cli.Context) (*ServicesConfig, error)
func (ServicesConfig) GetDefault ¶
func (s ServicesConfig) GetDefault() *ServiceConfig
func (ServicesConfig) GetMod ¶
func (s ServicesConfig) GetMod(name string) *ServiceConfig
func (ServicesConfig) GetMods ¶
func (s ServicesConfig) GetMods() []string
type Source ¶
type Source struct { Type string `json:"type"` Name string `json:"name"` InfoHash string `json:"info_hash"` Path string `json:"path"` OriginPath string `json:"origin_path"` Token string `json:"token"` ApiKey string `json:"api_key"` Query string `json:"query"` Mod *Mod }
Source struct represents torrent file source. Source may have additional modification.
func (*Source) GetEdgeName ¶
func (*Source) GetEdgeType ¶
type SourceType ¶
type SourceType string
const ( Internal SourceType = "internal" External SourceType = "external" )
type StandardClaims ¶
type StatRecord ¶
type ThrottledResponseWriter ¶
type ThrottledResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func NewThrottledRequestWrtier ¶
func NewThrottledRequestWrtier(w http.ResponseWriter, b *ratelimit.Bucket) *ThrottledResponseWriter
func (*ThrottledResponseWriter) Flush ¶
func (w *ThrottledResponseWriter) Flush()
func (*ThrottledResponseWriter) Hijack ¶
func (w *ThrottledResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*ThrottledResponseWriter) Write ¶
func (w *ThrottledResponseWriter) Write(p []byte) (int, error)
func (*ThrottledResponseWriter) WriteHeader ¶
func (w *ThrottledResponseWriter) WriteHeader(statusCode int)
type URLParser ¶
type URLParser struct {
// contains filtered or unexported fields
}
func NewURLParser ¶
func NewURLParser(c *ServicesConfig) *URLParser
type Web ¶
type Web struct {
// contains filtered or unexported fields
}
func NewWeb ¶
func NewWeb(c *cli.Context, parser *URLParser, r *Resolver, pr *HTTPProxy, claims *Claims, bp *Bucket, ch *ClickHouse, cfg *ServicesConfig, ah *AccessHistory) *Web
Click to show internal directories.
Click to hide internal directories.