global

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: MPL-2.0, MPL-2.0 Imports: 22 Imported by: 0

README

global state management

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBVersion string = "2020-07-31-rc"
View Source
var ECDHKexDerivedKey = make(map[string]KexDerivedKey)

ECDHKexDerivedKey stores kexDerivedKey with sessionID as key. For dashboard based login, key becomes sessionID of dashboard session. For enrol new device, key becomes trasaID of user For http session recording, key becomse sessionID of http session. It is responsibility of caller to delete keys after usage.

View Source
var LogToFile *bool
View Source
var OxyLog *logrus.Logger

OxyLog is logging instance for oxy with default error level.

Functions

func DBconn

func DBconn(config Config) *sql.DB

func SetOrgID

func SetOrgID(orgID string)

func UpdateTRASACPxyAddr

func UpdateTRASACPxyAddr(serverAddr string)

UpdateTRASACPxyAddr updates TRASA cloud proxy server address.

Types

type Config

type Config struct {
	Backup struct {
		Backupdir string `toml:"backupdir"`
	} `toml:"backup"`
	Database struct {
		Dbtype     string `toml:"dbname"`
		Dbname     string `toml:"dbname"`
		Dbuser     string `toml:"dbuser"`
		Dbpass     string `toml:"dbpass"`
		Port       string `toml:"port"`
		Server     string `toml:"server"`
		Sslenabled bool   `toml:"sslenabled"`
		Usercert   string `toml:"usercert"`
		Userkey    string `toml:"userkey"`
		Cacert     string `toml:"cacert"`
	} `toml:"database"`
	Etcd struct {
		Server   string `toml:"server"`
		Usercert string `toml:"usercert"`
		Userkey  string `toml:"userkey"`
		Cacert   string `toml:"cacert"`
	} `toml:"etcd"`
	Logging struct {
		Level         string `toml:"level"`
		SendErrReport string `toml:"sendErrReport"`
	} `toml:"logging"`
	Minio struct {
		Status bool   `toml:"status"`
		Key    string `toml:"key"`
		Secret string `toml:"secret"`
		Server string `toml:"server"`
		Usessl bool   `toml:"usessl"`
	} `toml:"minio"`
	Platform struct {
		Base string `toml:"base"`
	} `toml:"platform"`
	Redis struct {
		Port       string   `toml:"port"`
		Server     []string `toml:"server"`
		Sslenabled bool     `toml:"sslenabled"`
		Usercert   string   `toml:"usercert"`
		Userkey    string   `toml:"userkey"`
		Cacert     string   `toml:"cacert"`
	} `toml:"redis"`

	Security struct {
		InsecureSkipVerify bool `toml:"insecureSkipVerify"`
	} `toml:"security"`
	Trasa struct {
		ProxyDashboard bool   `toml:"proxyDashboard"`
		DashboardAddr  string `toml:"dashboardAddr"`
		AutoCert       bool   `toml:"autoCert"`
		ListenAddr     string `toml:"listenAddr"`
		Email          string `toml:"email"`
		Rootdomain     string `toml:"rootdomain"`
		CloudServer    string `toml:"cloudServer"`
		Ssodomain      string `toml:"ssodomain"`
		Rootdir        string `toml:"rootdir"`
		OrgId          string `toml:"orgID"`
	} `toml:"trasa"`
	Proxy struct {
		SSHListenAddr string `toml:"sshlistenAddr"`
		GuacdAddr     string `toml:"guacdAddr"`
		GuacdEnabled  bool   `toml:"guacdEnabled"`
	} `toml:"proxy"`
	Vault struct {
		Tsxvault bool   `toml:"tsxvault"`
		Port     string `toml:"port"`
		Server   string `toml:"server"`
		Token    string `toml:"token"`
	} `toml:"vault"`
}

func GetConfig

func GetConfig() Config

func ParseConfig

func ParseConfig() (config Config)

ParseConfig uses viper to parse TRASA config file.

type Gstate

type Gstate struct {
	// contains filtered or unexported fields
}

Gstate is a global state struct which contains database connections, configurations etc

type KexDerivedKey

type KexDerivedKey struct {
	// device id of client
	DeviceID string
	// secret key
	Secretkey []byte
	// Time of when secret key was derived
	Timestamp int64
}

KexDerivedKey stores secretkey derived from Kex, deviceID of device with which key was exchanged and timestamp recording kex operation.

type State

type State struct {
	DB             *sql.DB
	Geoip          *geoip2.Reader
	FirebaseClient *firebase.App
	MinioClient    *minio.Client
	VaultClient    *vault.Client
	//	EtcdClient     *clientv3.Client
	//Config      Config
	RedisClient    *redis.Client
	VaultRootToken string
	TsxvKey        tsxKey
	TsxCPxyKey     string
}

func InitDBSTORE

func InitDBSTORE() *State

func InitDBSTOREWithConfig

func InitDBSTOREWithConfig(conf Config) *State

Jump to

Keyboard shortcuts

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