Documentation ¶
Index ¶
- Constants
- func GetBaseURL() string
- func MakeJobID(cfg *JobConfig, params *InitParams) string
- func RegisterClickHouseDBFlags(f []cli.Flag) []cli.Flag
- func RegisterClickHouseFlags(f []cli.Flag) []cli.Flag
- func RegisterCommonFlags(f []cli.Flag) []cli.Flag
- func RegisterConnectionConfigFlags(f []cli.Flag) []cli.Flag
- func RegisterEndpointsFlags(f []cli.Flag) []cli.Flag
- func RegisterGRPCFlags(f []cli.Flag) []cli.Flag
- func RegisterGRPCProxyFlags(f []cli.Flag) []cli.Flag
- func RegisterHTTPProxyFlags(f []cli.Flag) []cli.Flag
- func RegisterJobFlags(f []cli.Flag) []cli.Flag
- func RegisterNodesStatFlags(f []cli.Flag) []cli.Flag
- func RegisterPromClientFlags(f []cli.Flag) []cli.Flag
- func RegisterSubdomainsFlags(f []cli.Flag) []cli.Flag
- func RegisterWebFlags(f []cli.Flag) []cli.Flag
- type AccessHistory
- type AccessLock
- type BucketPool
- type Claims
- type ClickHouse
- type ClickHouseDB
- type Client
- type Clients
- type ConnectionConfig
- type ConnectionType
- type ConnectionsConfig
- type DBProvider
- type DISTRIBUTION
- type Endpoints
- type EndpointsPool
- type GRPCProxy
- type GRPCServer
- type HTTPGRPCProxy
- type HTTPGRPCProxyPool
- type HTTPProxy
- type HTTPProxyPool
- type Init
- type InitParams
- type JobConfig
- type JobLocation
- type JobLocationPool
- type JobType
- type K8SClient
- type Location
- type Locker
- type Mod
- type NodeBandwidth
- type NodeCPU
- type NodeStat
- type NodeStatWithScore
- type NodesStat
- type NodesStatPool
- type Ports
- type PromClient
- 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 ServiceLocationPool
- type Source
- type SourceType
- type StandardClaims
- type StatRecord
- type Subdomains
- type SubdomainsPool
- type ThrottledResponseWriter
- type URLParser
- type Web
Constants ¶
View Source
const (
ClickhouseDSNFlag = "clickhouse-dsn"
)
Variables ¶
This section is empty.
Functions ¶
func GetBaseURL ¶
func GetBaseURL() string
func MakeJobID ¶
func MakeJobID(cfg *JobConfig, params *InitParams) string
Types ¶
type AccessHistory ¶
type AccessHistory struct {
// contains filtered or unexported fields
}
func NewAccessHistory ¶
func NewAccessHistory() *AccessHistory
type AccessLock ¶
type AccessLock struct { C chan error // contains filtered or unexported fields }
func NewAccessLock ¶
func NewAccessLock() *AccessLock
func (*AccessLock) Unlock ¶
func (al *AccessLock) Unlock()
func (*AccessLock) Unlocked ¶
func (al *AccessLock) Unlocked() chan error
type BucketPool ¶
type BucketPool struct {
// contains filtered or unexported fields
}
func NewBucketPool ¶
func NewBucketPool() *BucketPool
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 ConnectionConfig ¶
type ConnectionConfig struct { ServiceConfig JobConfig Name string ConnectionType ConnectionType Mod bool }
type ConnectionType ¶
type ConnectionType int
const ( ConnectionTypeService ConnectionType = 0 ConnectionTypeJob ConnectionType = 1 )
type ConnectionsConfig ¶
type ConnectionsConfig map[string]*ConnectionConfig
func NewConnectionsConfig ¶
func NewConnectionsConfig(c *cli.Context) *ConnectionsConfig
func (ConnectionsConfig) GetDefault ¶
func (s ConnectionsConfig) GetDefault() *ConnectionConfig
func (ConnectionsConfig) GetMod ¶
func (s ConnectionsConfig) GetMod(name string) *ConnectionConfig
func (ConnectionsConfig) GetMods ¶
func (s ConnectionsConfig) GetMods() []string
type DBProvider ¶
type EndpointsPool ¶
type EndpointsPool struct {
// contains filtered or unexported fields
}
func NewEndpointsPool ¶
func NewEndpointsPool(c *cli.Context, cl *K8SClient) *EndpointsPool
type GRPCProxy ¶
type GRPCProxy struct {
// contains filtered or unexported fields
}
func NewGRPCProxy ¶
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
func NewGRPCServer ¶
func NewGRPCServer(c *cli.Context, p *GRPCProxy) *GRPCServer
func (*GRPCServer) Close ¶
func (s *GRPCServer) Close()
func (*GRPCServer) Serve ¶
func (s *GRPCServer) Serve() error
type HTTPGRPCProxy ¶
type HTTPGRPCProxy struct {
// contains filtered or unexported fields
}
func NewHTTPGRPCProxy ¶
func NewHTTPGRPCProxy(p *GRPCProxy) *HTTPGRPCProxy
func (*HTTPGRPCProxy) Close ¶
func (s *HTTPGRPCProxy) Close()
func (*HTTPGRPCProxy) Get ¶
func (s *HTTPGRPCProxy) Get() *grpcweb.WrappedGrpcServer
type HTTPGRPCProxyPool ¶
type HTTPGRPCProxyPool struct {
// contains filtered or unexported fields
}
func NewHTTPGRPCProxyPool ¶
func (*HTTPGRPCProxyPool) Get ¶
func (s *HTTPGRPCProxyPool) Get(src *Source, logger *logrus.Entry) (*grpcweb.WrappedGrpcServer, error)
type HTTPProxy ¶
type HTTPProxy struct {
// contains filtered or unexported fields
}
func NewHTTPProxy ¶
type HTTPProxyPool ¶
type HTTPProxyPool struct {
// contains filtered or unexported fields
}
func NewHTTPProxyPool ¶
func NewHTTPProxyPool(c *cli.Context, r *Resolver) *HTTPProxyPool
type Init ¶
type Init struct { InitParams *InitParams ConnectionConfig *ConnectionConfig }
type InitParams ¶
type JobConfig ¶
type JobConfig struct { Type JobType Name string Image string CPURequests string CPULimits string MemoryRequests string MemoryLimits string Grace int IgnoredPaths []string UseSnapshot string ToCompletion bool SnapshotStartFullDownloadThreshold float64 SnapshotStartThreshold float64 SnapshotDownloadRatio float64 SnapshotTorrentSizeLimit int64 AWSAccessKeyID string AWSSecretAccessKey string AWSEndpoint string AWSRegion string AWSBucket string AWSBucketSpread string AWSNoSSL string RequestAffinity bool AffinityKey string AffinityValue string Env map[string]string Labels map[string]string HTTPProxy string }
func (*JobConfig) CheckIgnorePaths ¶
type JobLocation ¶
type JobLocation struct {
// contains filtered or unexported fields
}
func NewJobLocation ¶
func NewJobLocation(c *cli.Context, cfg *JobConfig, params *InitParams, cl *K8SClient, logger *logrus.Entry, l *Locker, acl *Client) *JobLocation
func (*JobLocation) Get ¶
func (s *JobLocation) Get() (*Location, error)
func (*JobLocation) Wait ¶
func (s *JobLocation) Wait() (*Location, error)
type JobLocationPool ¶
type JobLocationPool struct {
// contains filtered or unexported fields
}
func NewJobLocationPool ¶
func NewJobLocationPool(c *cli.Context, cl *K8SClient, l *Locker) *JobLocationPool
type K8SClient ¶
type K8SClient struct {
// contains filtered or unexported fields
}
func NewK8SClient ¶
func NewK8SClient() *K8SClient
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
func NewLocker ¶
func NewLocker(r *cs.RedisClient) *Locker
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 NodeBandwidth ¶
type NodeStatWithScore ¶
type NodesStat ¶
type NodesStat struct {
// contains filtered or unexported fields
}
func NewNodesStat ¶
func NewNodesStat(c *cli.Context, pcl *PromClient, kcl *K8SClient) *NodesStat
type NodesStatPool ¶
type NodesStatPool struct {
// contains filtered or unexported fields
}
func NewNodesStatPool ¶
func NewNodesStatPool(c *cli.Context, pcl *PromClient, kcl *K8SClient) *NodesStatPool
func (*NodesStatPool) Get ¶
func (s *NodesStatPool) Get() ([]NodeStat, error)
type PromClient ¶
type PromClient struct {
// contains filtered or unexported fields
}
func NewPromClient ¶
func NewPromClient(c *cli.Context) *PromClient
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver(baseURL string, cfg *ConnectionsConfig, svcLocPool *ServiceLocationPool, jobLocPool *JobLocationPool) *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 Distribution DISTRIBUTION PreferLocalNode bool Headers map[string]string }
type ServiceLocation ¶
type ServiceLocation struct {
// contains filtered or unexported fields
}
func NewServiceLocation ¶
func NewServiceLocation(c *cli.Context, cfg *ServiceConfig, params *InitParams, ep *EndpointsPool) *ServiceLocation
type ServiceLocationPool ¶
type ServiceLocationPool struct {
// contains filtered or unexported fields
}
func NewServiceLocationPool ¶
func NewServiceLocationPool(c *cli.Context, ep *EndpointsPool) *ServiceLocationPool
func (*ServiceLocationPool) Get ¶
func (s *ServiceLocationPool) Get(cfg *ServiceConfig, params *InitParams, purge bool) (*Location, error)
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 Subdomains ¶
type Subdomains struct {
// contains filtered or unexported fields
}
func NewSubdomains ¶
func NewSubdomains(c *cli.Context, k8s *K8SClient, nsp *NodesStatPool, infoHash string, skipActiveJobSearch bool, useCPU bool, useBandwidth bool, pools []string) *Subdomains
func (*Subdomains) Get ¶
func (s *Subdomains) Get() ([]NodeStatWithScore, []string, error)
type SubdomainsPool ¶
type SubdomainsPool struct {
// contains filtered or unexported fields
}
func NewSubdomainsPool ¶
func NewSubdomainsPool(c *cli.Context, k8s *K8SClient, nsp *NodesStatPool) *SubdomainsPool
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 *ConnectionsConfig) *URLParser
type Web ¶
type Web struct {
// contains filtered or unexported fields
}
func NewWeb ¶
func NewWeb(c *cli.Context, baseURL string, parser *URLParser, r *Resolver, pr *HTTPProxyPool, grpc *HTTPGRPCProxyPool, claims *Claims, subs *SubdomainsPool, bp *BucketPool, ch *ClickHouse, cfg *ConnectionsConfig, ah *AccessHistory) *Web
Source Files ¶
- access_history.go
- access_lock.go
- base_url.go
- bucket_pool.go
- claims.go
- clickhouse.go
- clickhouse_db.go
- clients.go
- common.go
- connections_config.go
- endpoints.go
- endpoints_pool.go
- grpc_proxy.go
- grpc_server.go
- http_grpc_proxy.go
- http_grpc_proxy_pool.go
- http_proxy.go
- http_proxy_pool.go
- job_location.go
- job_location_pool.go
- k8s_client.go
- locker.go
- nodes_stat.go
- nodes_stat_pool.go
- prom_client.go
- rand.go
- resolver.go
- response_writer_interceptor.go
- service_location.go
- service_location_pool.go
- subdomains.go
- subdomains_pool.go
- throttled_request_writer.go
- url_parser.go
- web.go
Click to show internal directories.
Click to hide internal directories.