config

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfPath *string

ConfPath config file path

Functions

This section is empty.

Types

type Config

type Config struct {
	Users   *map[string]*User   `yaml:"users"`
	Servers *map[string]*Server `yaml:"servers"`
}

Config config

var Conf *Config

Conf config obj

func (*Config) AddServer

func (c *Config) AddServer(name string, host string, port int) (string, *Server)

AddServer add server to config

func (*Config) AddServerSSHUser

func (c *Config) AddServerSSHUser(serverKey string, username string, identityFile string, allowUsers *[]string) (string, *SSHUser)

AddServerSSHUser add server ssh user to config

func (*Config) AddUser

func (c *Config) AddUser(username string, password string, IsAdmin bool, pubKey string) (string, *User)

AddUser add user to config

func (*Config) GetServerByName added in v1.2.6

func (c *Config) GetServerByName(name string) *Server

GetServerByName GetServerByName

func (*Config) GetServerSSHUsers

func (c *Config) GetServerSSHUsers(user *User, server *Server) map[string]*SSHUser

GetServerSSHUsers get all allow server' s ssh users

func (*Config) GetUserByUsername

func (c *Config) GetUserByUsername(username string) *User

GetUserByUsername GetUserByUsername

func (*Config) GetUserServers

func (c *Config) GetUserServers(user *User) map[string]*Server

GetUserServers get user servers list

func (*Config) ReIndexServer

func (c *Config) ReIndexServer()

ReIndexServer ReIndexServer

func (*Config) ReIndexUser

func (c *Config) ReIndexUser()

ReIndexUser ReIndexUser

func (*Config) ReadFrom

func (c *Config) ReadFrom(path string) error

ReadFrom read config

func (*Config) SaveTo

func (c *Config) SaveTo(path string) error

SaveTo save config

type SSHUser

type SSHUser struct {
	SSHUsername  string    `yaml:"sshUsername"`
	IdentityFile string    `yaml:"identityFile"`
	AllowUsers   *[]string `yaml:"allowUsers,omitempty"`
}

SSHUser ssh user

type Server

type Server struct {
	Name     string               `yaml:"name"`
	Host     string               `yaml:"host"`
	Port     int                  `yaml:"port"`
	SSHUsers *map[string]*SSHUser `yaml:"sshUsers"`
}

Server server

type User

type User struct {
	Username   string `yaml:"username"`
	HashPasswd string `yaml:"hashPasswd"`
	Admin      bool   `yaml:"admin"`
	PublicKey  string `yaml:"publickey"`
}

User gortal login user

Jump to

Keyboard shortcuts

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