conf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-3.0 Imports: 21 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClientCred credentials.TransportCredentials
	Version    string
)

Functions

func FRPsAuthOption

func FRPsAuthOption(isDefault bool) v1.HTTPPluginOptions

func GetAPIURL

func GetAPIURL() string

func GetCertTemplate

func GetCertTemplate() *x509.Certificate

func GetCommonJWT

func GetCommonJWT(uid string) string

func GetCommonJWTWithExpireTime

func GetCommonJWTWithExpireTime(uid string, expSec int) string

func InitConfig

func InitConfig()

func InternalFRPServerToken

func InternalFRPServerToken() string

func JWTSecret

func JWTSecret() string

func MasterAPIListenAddr

func MasterAPIListenAddr() string

func MasterDefaultSalt

func MasterDefaultSalt() string

func RPCCallAddr

func RPCCallAddr() string

func RPCListenAddr

func RPCListenAddr() string

func ServerAPIListenAddr

func ServerAPIListenAddr() string

Types

type Config

type Config struct {
	App struct {
		Secret         string `env:"SECRET" env-description:"app secret, for client and server frp salt"`
		GlobalSecret   string `env:"GLOBAL_SECRET" env-default:"frp-panel" env-description:"global secret, used in manager gen secret, keep it safe"`
		CookieAge      int    `env:"COOKIE_AGE" env-default:"86400" env-description:"cookie age in second, default is 1 day"`
		CookieName     string `env:"COOKIE_NAME" env-default:"frp-panel-cookie" env-description:"cookie name"`
		CookiePath     string `env:"COOKIE_PATH" env-default:"/" env-description:"cookie path"`
		CookieDomain   string `env:"COOKIE_DOMAIN" env-default:"" env-description:"cookie domain"`
		CookieSecure   bool   `env:"COOKIE_SECURE" env-default:"false" env-description:"cookie secure"`
		CookieHTTPOnly bool   `env:"COOKIE_HTTP_ONLY" env-default:"true" env-description:"cookie http only"`
		EnableRegister bool   `env:"ENABLE_REGISTER" env-default:"false" env-description:"enable register, only allow the first admin to register"`
	} `env-prefix:"APP_"`
	Master struct {
		APIPort                   int    `env:"API_PORT" env-default:"9000" env-description:"master api port"`
		APIHost                   string `env:"API_HOST" env-description:"master host, can behind proxy like cdn"`
		APIScheme                 string `env:"API_SCHEME" env-default:"http" env-description:"master api scheme"`
		CacheSize                 int    `env:"CACHE_SIZE" env-default:"10" env-description:"cache size in MB"`
		RPCHost                   string `env:"RPC_HOST" env-default:"127.0.0.1" env-description:"master host, is a public ip or domain"`
		RPCPort                   int    `env:"RPC_PORT" env-default:"9001" env-description:"master rpc port"`
		CompatibleMode            bool   `env:"COMPATIBLE_MODE" env-default:"false" env-description:"compatible mode, for official frp client"`
		InternalFRPServerHost     string `env:"INTERNAL_FRP_SERVER_HOST" env-description:"internal frp server host, used for client connection"`
		InternalFRPServerPort     int    `env:"INTERNAL_FRP_SERVER_PORT" env-default:"9002" env-description:"internal frp server port, used for client connection"`
		InternalFRPAuthServerHost string `env:"INTERNAL_FRP_AUTH_SERVER_HOST" env-default:"127.0.0.1" env-description:"internal frp auth server host"`
		InternalFRPAuthServerPort int    `env:"INTERNAL_FRP_AUTH_SERVER_PORT" env-default:"8999" env-description:"internal frp auth server port"`
		InternalFRPAuthServerPath string `env:"INTERNAL_FRP_AUTH_SERVER_PATH" env-default:"/auth" env-description:"internal frp auth server path"`
	} `env-prefix:"MASTER_"`
	Server struct {
		APIPort int `env:"API_PORT" env-default:"8999" env-description:"server api port"`
	} `env-prefix:"SERVER_"`
	DB struct {
		Type string `env:"TYPE" env-default:"sqlite3" env-description:"db type, mysql or sqlite3 and so on"`
		DSN  string `` /* 159-byte string literal not displayed */
	} `env-prefix:"DB_"`
	Client struct {
		ID     string `env:"ID" env-description:"client id"`
		Secret string `env:"SECRET" env-description:"client secret"`
	} `env-prefix:"CLIENT_"`
	IsDebug bool `env:"IS_DEBUG" env-default:"false" env-description:"is debug mode"`
}

func Get

func Get() *Config

func (*Config) Complete

func (cfg *Config) Complete()

type VersionInfo added in v0.0.32

type VersionInfo struct {
	GitVersion string `json:"gitVersion" yaml:"gitVersion"`
	GitCommit  string `json:"gitCommit" yaml:"gitCommit"`
	BuildDate  string `json:"buildDate" yaml:"buildDate"`
	GoVersion  string `json:"goVersion" yaml:"goVersion"`
	Compiler   string `json:"compiler" yaml:"compiler"`
	Platform   string `json:"platform" yaml:"platform"`
}

func GetVersion added in v0.0.32

func GetVersion() *VersionInfo

func (*VersionInfo) String added in v0.0.32

func (v *VersionInfo) String() string

func (*VersionInfo) ToProto added in v0.0.32

func (v *VersionInfo) ToProto() *pb.ClientVersion

Jump to

Keyboard shortcuts

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