settings

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: MIT Imports: 13 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserAllowAll = regexp.MustCompile("")

Functions

func EncodeConfig

func EncodeConfig(c Config) []byte

func Env added in v1.7.3

func Env(name string) string

Env returns a chisel environment variable

func EnvBool added in v1.8.0

func EnvBool(name string) bool

EnvBool returns a boolean using an environment variable

func EnvDuration added in v1.7.3

func EnvDuration(name string, def time.Duration) time.Duration

EnvDuration returns a duration using an environment variable, with a default fallback

func EnvInt added in v1.7.3

func EnvInt(name string, def int) int

EnvInt returns an integer using an environment variable, with a default fallback

func L4Proto

func L4Proto(s string) (head, proto string)

L4Proto extacts the layer-4 protocol from the given string

func ParseAuth

func ParseAuth(auth string) (string, string)

Types

type Config

type Config struct {
	Version string
	Remotes
}

func DecodeConfig

func DecodeConfig(b []byte) (*Config, error)

type Remote

type Remote struct {
	LocalHost, LocalPort, LocalProto    string
	RemoteHost, RemotePort, RemoteProto string
	Socks, Reverse, Stdio               bool
}

func DecodeRemote

func DecodeRemote(s string) (*Remote, error)

func (Remote) CanListen

func (r Remote) CanListen() bool

CanListen checks if the port can be listened on

func (Remote) Encode

func (r Remote) Encode() string

Encode remote to a string

func (Remote) Local

func (r Remote) Local() string

Local is the decodable local portion

func (Remote) Remote

func (r Remote) Remote() string

Remote is the decodable remote portion

func (Remote) String

func (r Remote) String() string

implement Stringer

func (Remote) UserAddr

func (r Remote) UserAddr() string

UserAddr is checked when checking if a user has access to a given remote

type Remotes

type Remotes []*Remote

func (Remotes) Encode

func (rs Remotes) Encode() []string

Encode back into strings

func (Remotes) Reversed

func (rs Remotes) Reversed(reverse bool) Remotes

Filter out forward reversed/non-reversed remotes

type User

type User struct {
	Name  string
	Pass  string
	Addrs []*regexp.Regexp
}

func (*User) HasAccess

func (u *User) HasAccess(addr string) bool

type UserIndex

type UserIndex struct {
	*cio.Logger
	*Users
	// contains filtered or unexported fields
}

UserIndex is a reloadable user source

func NewUserIndex

func NewUserIndex(logger *cio.Logger) *UserIndex

NewUserIndex creates a source for users

func (*UserIndex) LoadUsers

func (u *UserIndex) LoadUsers(configFile string) error

LoadUsers is responsible for loading users from a file

type Users

type Users struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewUsers

func NewUsers() *Users

func (*Users) AddUser

func (u *Users) AddUser(user *User)

AddUser adds a users to the set

func (*Users) Del

func (u *Users) Del(key string)

Del ete a users from the list

func (*Users) Get

func (u *Users) Get(key string) (*User, bool)

Get user from the index by key

func (*Users) Len

func (u *Users) Len() int

Len returns the numbers of users

func (*Users) Reset

func (u *Users) Reset(users []*User)

Reset all users to the given set, Use nil to remove all.

func (*Users) Set

func (u *Users) Set(key string, user *User)

Set a users into the list by specific key

Jump to

Keyboard shortcuts

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