utils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BreakAADWaitLoop

func BreakAADWaitLoop()

func GenerateRandomBytes

func GenerateRandomBytes(n int) []byte

func GenerateRandomString

func GenerateRandomString(s int) string

func GetBreakAADWaitLoop

func GetBreakAADWaitLoop() bool

func SegmentEventServerVPNConnectionLogin

func SegmentEventServerVPNConnectionLogin(upn string)

func SegmentEventUserClientLogin

func SegmentEventUserClientLogin(user string)

func SegmentEventUserLogin

func SegmentEventUserLogin(user string)

func SegmentEventUserVPNConnectionLogin

func SegmentEventUserVPNConnectionLogin(user string)

func SetAADWaitLoop

func SetAADWaitLoop()

Types

type Config

type Config struct {
	Server struct {
		Port            string   `yaml:"port", envconfig:"PORT"`
		Loglevel        int      `yaml:"loglevel", envconfig:"LOGLEVEL"`
		URI             string   `yaml:"uri", envconfig:"URI"`
		JobAPIKey       string   `yaml:"jobapikey", envconfig:"JOBAPIKEY"`
		WebSocketUrl    string   `yaml:"websocketurl", envconfig:"WEBSOCKETURL"`
		WebSocketIPs    []string `yaml:"websocketips", envconfig:"WEBSOCKETIPS"`
		StoreHeartBeats bool     `yaml:"store_heartbeats", envconfig:"STORE_HEARTBEATS"`
	} `yaml:"server"`
	OAuthServer struct {
		Secret   string `yaml:"secret", envconfig:"SECRET"`
		Duration int    `yaml:"duration", envconfig:"DURATION"`
	} `yaml:"oauthserver"`
	Auth struct {
		Issuer         string       `yaml:"issuer", envconfig:"AUTH_ISSUER"`
		InternalIssuer string       `yaml:"internal_issuer", envconfig:"AUTH_INTERNALISSUER"`
		Audience       []string     `yaml:"audience", envconfig:"AUTH_AUDIENCE"`
		AuthorizeUrl   string       `yaml:"authorize_url", envconfig:"AUTH_AUTHORIZEURL"`
		CallbackUrl    string       `yaml:"callback_url", envconfig:"AUTH_CALLBACKURL"`
		Shieldoo       ShieldooConf `yaml:"shieldoo", envconfig:"AUTH_SHIELDOO"`
		AdminUser      string       `yaml:"admin_user", envconfig:"AUTH_ADMINUSER"`
	} `yaml:"auth"`
	Database struct {
		Url        string `yaml:"url", envconfig:"URL"`
		MaxRecords int    `yaml:"maxrecords", envconfig:"MAXRECORDS"`
		Log        struct {
			LogLevel             int  `yaml:"loglevel"`
			SlowQueryms          int  `yaml:"slowqueryms"`
			IgnoreRecordNotFound bool `yaml:"ignorerecordnotfound"`
			Colorful             bool `yaml:"colorful"`
		}
	} `yaml:"database"`
	Lighthouses struct {
		MaxLighthouses int                `yaml:"maxlighthouses", envconfig:"MAXLIGHTHOUSES"`
		Secret         string             `yaml:"secret", envconfig:"SECRET"`
		InstancesMap   map[string]string  `envconfig:"INSTANCESMAP"`
		Instances      []ConfigLighthouse `yaml:"instances"`
	} `yaml:"lighthouses"`
	CostManagement struct {
		MonthPrice float64 `yaml:"monthprice", envconfig:"MONTHPRICE"`
		HourPrice  float64 `yaml:"hourprice", envconfig:"HOURPRICE"`
	} `yaml:"costmanagement"`
	// external plugins
	Segment          SegmentEventInterface              `yaml:"-"`
	SecurityLogStore logstore.SecurityLogStoreInterface `yaml:"-"`
	LogStore         logstore.LogStoreInterface         `yaml:"-"`
	ModelEncyptor    ModelEncyptorInterface             `yaml:"-"`
	Emailing         EmailInterface                     `yaml:"-"`
}

func Init

func Init() *Config

type ConfigLighthouse

type ConfigLighthouse struct {
	Port    int    `yaml:"port"`
	Address string `yaml:"address"`
}

type EmailInterface

type EmailInterface interface {
	SendInvitationEmail(upn string, domain string)
}

type ModelEncyptorInterface

type ModelEncyptorInterface interface {
	Encrypt(data string) (string, error)
	Decrypt(data string) (string, error)
}

type SegmentEventInterface

type SegmentEventInterface interface {
	SegmentEvent(name string, upn string)
}

type ShieldooConf

type ShieldooConf struct {
	TenantId string `yaml:"tenantid", envconfig:"AUTH_SHIELDOO_TENANTID"`
}

Jump to

Keyboard shortcuts

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