config

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2021 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LRUTimeout = 30 * time.Minute
)
View Source
const (
	PullingErrorKey = "__pulling_error__"
)

Variables

View Source
var IncorrectPasswordErr = fmt.Errorf("incorrect password")
View Source
var InvalidUpstreamErr = fmt.Errorf("invalid upstream")
View Source
var (
	Version = "debug"
)

Functions

func Map2Upstream added in v0.1.4

func Map2Upstream(m UpstreamConf, upstream interface{}) error

func SetConfig added in v0.1.3

func SetConfig(conf *Config)

Types

type AccessKey

type AccessKey struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	Password         string `json:"password"`
	Port             int    `json:"port"`
	EncryptionMethod string `json:"encryptionMethod"`
	Method           string `json:"method"` // the alias of EncryptionMethod
}

func (*AccessKey) ToServer

func (key *AccessKey) ToServer(name, host string) Server

type Config

type Config struct {
	ConfPath string  `json:"-"`
	Groups   []Group `json:"groups"`
}

func BuildConfig added in v0.1.3

func BuildConfig(confPath string) (conf *Config, err error)

func GetConfig

func GetConfig() *Config

func (*Config) CheckDiverseCombinations

func (config *Config) CheckDiverseCombinations() error

func (*Config) CheckMethodSupported

func (config *Config) CheckMethodSupported() error

type Group

type Group struct {
	Name            string           `json:"name"`
	Port            int              `json:"port"`
	Servers         []Server         `json:"servers"`
	Upstreams       []UpstreamConf   `json:"upstreams"`
	UserContextPool *UserContextPool `json:"-"`
}

func (*Group) BuildMasterKeys

func (g *Group) BuildMasterKeys()

func (*Group) BuildUserContextPool

func (g *Group) BuildUserContextPool(timeout time.Duration)

type Outline

type Outline struct {
	Name          string `json:"name"`
	Type          string `json:"type"`
	Server        string `json:"server"`
	Link          string `json:"link"`
	SSHPort       string `json:"sshPort"`
	SSHUsername   string `json:"sshUsername"`
	SSHPrivateKey string `json:"sshPrivateKey"`
	SSHPassword   string `json:"sshPassword"`
	ApiUrl        string `json:"apiUrl"`
	ApiCertSha256 string `json:"apiCertSha256"`
}

func (Outline) GetName added in v0.1.6

func (outline Outline) GetName() string

func (Outline) GetServers

func (outline Outline) GetServers() (servers []Server, err error)

type Server

type Server struct {
	Name         string        `json:"name"`
	Target       string        `json:"target"`
	Method       string        `json:"method"`
	Password     string        `json:"password"`
	MasterKey    []byte        `json:"-"`
	UpstreamConf *UpstreamConf `json:"-"`
}

type ShadowboxConfig

type ShadowboxConfig struct {
	AccessKeys []AccessKey `json:"accessKeys"`
}

func (*ShadowboxConfig) ToServers

func (c *ShadowboxConfig) ToServers(name, host string) []Server

type Upstream

type Upstream interface {
	GetName() string
	GetServers() (servers []Server, err error)
}

type UpstreamConf added in v0.1.4

type UpstreamConf map[string]interface{}

func (UpstreamConf) Equal added in v0.1.4

func (uc UpstreamConf) Equal(that UpstreamConf) bool

func (UpstreamConf) GetPullingError added in v0.1.7

func (uc UpstreamConf) GetPullingError() error

func (UpstreamConf) SetPullingError added in v0.1.7

func (uc UpstreamConf) SetPullingError(err error)

type UserContext

type UserContext lrulist.LruList

encapsulating semantic types

func NewUserContext

func NewUserContext(servers []Server) *UserContext

func (*UserContext) Auth

func (ctx *UserContext) Auth(probe func(*Server) ([]byte, bool)) (hit *Server, content []byte)

func (*UserContext) Close

func (ctx *UserContext) Close() error

func (*UserContext) Infra

func (ctx *UserContext) Infra() *lrulist.LruList

type UserContextPool

type UserContextPool lru.LRU

func (*UserContextPool) GetOrInsert added in v0.1.2

func (pool *UserContextPool) GetOrInsert(addr net.Addr, servers []Server) *UserContext

func (*UserContextPool) Infra

func (pool *UserContextPool) Infra() *lru.LRU

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL