Documentation ¶
Index ¶
- Variables
- func GetAcceptEncodingKey(ctx context.Context) (v string)
- func Init(cfg source.Entity, options ...source.Option) (err error)
- func SetAcceptEncodingKey(ctx context.Context, value string) context.Context
- type Clients
- type Endpoint
- type GRPC
- type Limiter
- type LimiterName
- type Listen
- type Logger
- type Loki
- type OAuth2
- type ProviderType
- type RateLimit
- type ServerParams
- type Storage
- type TLS
Constants ¶
This section is empty.
Variables ¶
View Source
var URLTemplate = map[ProviderType]string{ OSS: "https://%s.aliyuncs.com", OOS: "https://oos-%s.ctyunapi.cn", KODO: "https://s3-%s.qiniucs.com", COS: "https://cos.%s.myqcloud.com", OBS: "https://obs.%s.myhuaweicloud.com", BOS: "https://s3.%s.bcebos.com", GCS: "https://storage.googleapis.com", KS3: "https://ks3-%s.ksyuncs.com", }
URLTemplate storage provider url template
Functions ¶
func GetAcceptEncodingKey ¶ added in v0.0.5
Types ¶
type Clients ¶ added in v0.1.5
type Clients map[string]ServerParams
type Endpoint ¶ added in v0.1.1
type Endpoint struct { AuthURL string `yaml:"authURL" json:"authURL"` DeviceAuthURL string `yaml:"deviceAuthURL" json:"deviceAuthURL"` TokenURL string `yaml:"tokenURL" json:"tokenURL"` // AuthStyle optionally specifies how the endpoint wants the // client ID & client secret sent. The zero value means to // auto-detect. AuthStyle int `yaml:"authStyle" json:"authStyle"` }
type GRPC ¶
type GRPC struct { ServerParams `yaml:",inline" json:",inline"` Clients Clients `yaml:"client" json:"client"` }
GRPC grpc服务公共配置(选用)
func (*GRPC) GetGRPCClient ¶ added in v0.1.5
func (e *GRPC) GetGRPCClient(key string, opts ...grpc.DialOption) *grpc.ClientConn
func (*GRPC) Init ¶
func (e *GRPC) Init( register func(srv *serverGRPC.Server), opts ...serverGRPC.Option) server.Runnable
Init grpc server
type LimiterName ¶ added in v0.1.0
type LimiterName string
const (
SingleLimiter LimiterName = "single"
)
type Listen ¶
type Listen struct { Name string `yaml:"name" json:"name"` Addr string `yaml:"addr" json:"addr"` CertFile string `yaml:"certFile" json:"certFile"` KeyFile string `yaml:"keyFile" json:"keyFile"` Timeout int `yaml:"timeout" json:"timeout"` // default: 10s Metrics bool `yaml:"metrics" json:"metrics"` Healthz bool `yaml:"healthz" json:"healthz"` Readyz bool `yaml:"readyz" json:"readyz"` Pprof bool `yaml:"pprof" json:"pprof"` }
Listen tcp listener config
type Logger ¶
type Logger struct { Path string `yaml:"path" json:"path"` Level slog.Level `yaml:"level" json:"level"` Stdout string `yaml:"stdout" json:"stdout"` AddSource bool `yaml:"addSource" json:"addSource"` Cap uint `yaml:"cap" json:"cap"` Json bool `yaml:"json" json:"json"` BufferSize uint `yaml:"bufferSize" json:"bufferSize"` Loki *Loki `yaml:"loki" json:"loki"` }
Logger logger配置
type Loki ¶ added in v0.1.9
type Loki struct { URL string `yaml:"url" json:"url"` Labels map[string]string `yaml:"labels" json:"labels"` Interval time.Duration `yaml:"interval" json:"interval"` }
func (*Loki) MergeLabels ¶ added in v0.1.9
type OAuth2 ¶
type OAuth2 struct { Issuer string `yaml:"issuer" json:"issuer"` Endpoint Endpoint `yaml:"endpoint" json:"endpoint"` ClientID string `yaml:"clientID" json:"clientID"` ClientSecret string `yaml:"clientSecret" json:"clientSecret"` Scopes []string `yaml:"scopes" json:"scopes"` RedirectURL string `yaml:"redirectURL" json:"redirectURL"` AllowGroup []string `yaml:"allowGroup" json:"allowGroup"` }
OAuth2 holds the configuration for the OAuth2 provider.
func (*OAuth2) GetClientID ¶
GetClientID returns the OAuth2 client ID.
func (*OAuth2) GetClientSecret ¶
GetClientSecret returns the OAuth2 client secret.
func (*OAuth2) GetOAuth2Config ¶
GetOAuth2Config returns an oauth2.Config.
func (*OAuth2) GetRedirectURL ¶
GetRedirectURL returns the OAuth2 redirect URL.
type ProviderType ¶
type ProviderType string
ProviderType storage provider type
const ( // S3 aws s3 S3 ProviderType = "s3" // OSS aliyun oss OSS ProviderType = "oss" // OOS ctyun oos OOS ProviderType = "oos" // KODO qiniu kodo KODO ProviderType = "kodo" // COS tencent cos COS ProviderType = "cos" // OBS huawei obs OBS ProviderType = "obs" // BOS baidu bos BOS ProviderType = "bos" // GCS google gcs GCS ProviderType = "gcs" // KS3 kingsoft ks3 KS3 ProviderType = "ks3" // MINIO minio storage MINIO ProviderType = "minio" )
type RateLimit ¶ added in v0.1.0
type RateLimit struct { // 限流器类型 Name LimiterName `json:"name" yaml:"name"` // 限流器配置 Rate float64 `json:"rate" yaml:"rate"` // 限流器最大存储令牌数 Bursts int `json:"bursts" yaml:"bursts"` }
type ServerParams ¶ added in v0.1.5
type Storage ¶
type Storage struct { Type ProviderType `yaml:"type"` SigningMethod string `yaml:"signingMethod"` Region string `yaml:"region"` Bucket string `yaml:"bucket"` Endpoint string `yaml:"endpoint"` AccessKeyID string `yaml:"accessKeyID"` SecretAccessKey string `yaml:"secretAccessKey"` // contains filtered or unexported fields }
Storage storage
Source Files ¶
Click to show internal directories.
Click to hide internal directories.