model

package
v0.0.0-...-ec5e93e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TicketOpen     = "pending"
	TicketApproved = "approved"
	TicketRejected = "rejected"
	TicketClosed   = "closed"
)
View Source
const (
	AssetType = iota
	NodeType
	UserType
	SystemUserType
	AssetUserInfoType
	UserlogType
	LoginTicketType
	UserSecretType
)
View Source
const (
	ProtocolSSH = "ssh"
)

Variables

This section is empty.

Functions

func SortNodesByKey

func SortNodesByKey(nodes []Node)

func SortSystemUserByPriority

func SortSystemUserByPriority(sysUsers []SystemUser)

Types

type Asset

type Asset struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	Hostname  string   `json:"hostname"`
	IP        string   `json:"ip"`
	Os        string   `json:"os"`
	Comment   string   `json:"comment"`
	Protocols []string `json:"protocols"`
	Platform  string   `json:"platform"`
	IsActive  bool     `json:"is_active"`
}

func (*Asset) IsSupportProtocol

func (a *Asset) IsSupportProtocol(protocol string) bool

func (*Asset) ProtocolPort

func (a *Asset) ProtocolPort(protocol string) int

func (*Asset) String

func (a *Asset) String() string

type AssetList

type AssetList []Asset

func (AssetList) SortBy

func (a AssetList) SortBy(byIp bool) AssetList

type AssetLoginTicketInfo

type AssetLoginTicketInfo struct {
	TicketId    string   `json:"ticket_id"`
	NeedConfirm bool     `json:"need_confirm"`
	Reviewers   []string `json:"reviewers"`
}

type AssetNodeSorter

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

func (*AssetNodeSorter) Len

func (a *AssetNodeSorter) Len() int

func (*AssetNodeSorter) Less

func (a *AssetNodeSorter) Less(i, j int) bool

func (*AssetNodeSorter) Swap

func (a *AssetNodeSorter) Swap(i, j int)

type AssetUserInfo

type AssetUserInfo struct {
	ID           string
	UserID       string
	AssetID      string
	ExpireAt     int64
	SysUserID    []string
	EnableVscode bool
	NeedConfirm  bool
}

type ExpireInfo

type ExpireInfo struct {
	ExpireAt int64 `json:"expire_at"`
}

func (*ExpireInfo) IsExpired

func (e *ExpireInfo) IsExpired(now time.Time) bool

type LoginTicket

type LoginTicket struct {
	TicketId        string
	State           string
	Approver        string
	ApplicationDate string
	ApproveDate     string
	Username        string
	AssetName       string
	SysUsername     string
}

type Node

type Node struct {
	ID       string `json:"id"`
	Key      string `json:"key"`
	Name     string `json:"name"`
	AssetIDs []string
}

type NodeList

type NodeList []Node

type PaginationParam

type PaginationParam struct {
	PageSize int
	Offset   int
	Searches []string
	Refresh  bool
}

type PaginationResponse

type PaginationResponse struct {
	Total       int                      `json:"count"`
	NextURL     string                   `json:"next"`
	PreviousURL string                   `json:"previous"`
	Data        []map[string]interface{} `json:"results"`
}

type Session

type Session struct {
	ID           string    `json:"id"`
	User         string    `json:"user"`
	Asset        string    `json:"asset"`
	SystemUser   string    `json:"system_user"`
	LoginFrom    string    `json:"login_from"`
	RemoteAddr   string    `json:"remote_addr"`
	Protocol     string    `json:"protocol"`
	DateStart    time.Time `json:"date_start"`
	UserID       string    `json:"user_id"`
	AssetID      string    `json:"asset_id"`
	SystemUserID string    `json:"system_user_id"`
}

type SystemUser

type SystemUser struct {
	ID         string `json:"id"`
	Username   string `json:"username"`
	Priority   int    `json:"priority"`
	Protocol   string `json:"protocol"`
	Comment    string `json:"comment"`
	Password   string `json:"-"`
	PrivateKey string `json:"-"`
}

func (*SystemUser) IsProtocol

func (s *SystemUser) IsProtocol(p string) bool

func (*SystemUser) String

func (s *SystemUser) String() string

type TerminalConfig

type TerminalConfig struct {
	AssetListPageSize string `json:"TERMINAL_ASSET_LIST_PAGE_SIZE"`
	HeaderTitle       string `json:"TERMINAL_HEADER_TITLE"`
	HostKey           string `json:"-"`
	//Minute
	MaxIdleTime        int  `json:"MAX_IDLE_TIME"`
	AssetListSortByIp  bool `json:"TERMINAL_ASSET_LIST_SORT_BY_IP"`
	PasswordAuth       bool `json:"TERMINAL_PASSWORD_AUTH"`
	PublicKeyAuth      bool `json:"TERMINAL_PUBLIC_KEY_AUTH"`
	EnableSessionShare bool `json:"SECURITY_SESSION_SHARE"`
}

type TicketState

type TicketState struct {
	Approver string `json:"approver,omitempty"`
	State    string `json:"state"`
}

type User

type User struct {
	ID            string `json:"id"`
	Username      string `json:"name"`
	Role          string `json:"role"`
	ExpireAt      int64
	OTPLevel      int  `json:"otp_level"`
	IsActive      bool `json:"is_active"`
	NodeIDs       []string
	AddrWhiteList []string
}

USER TABLE

func (*User) String

func (u *User) String() string

type UserClient

type UserClient struct {
	Username   string
	Password   string
	PublicKey  string
	RemoteAddr string
}

func (*UserClient) SetOption

func (u *UserClient) SetOption(setters ...UserClientOption)

type UserClientOption

type UserClientOption func(*UserClient)

func UserClientPassword

func UserClientPassword(password string) UserClientOption

func UserClientPublicKey

func UserClientPublicKey(publicKey string) UserClientOption

func UserClientRemoteAddr

func UserClientRemoteAddr(addr string) UserClientOption

type UserLog

type UserLog struct {
	Datetime string
	Type     string
	User     string
	Log      string
}

type UserSecret

type UserSecret struct {
	UserID         string
	Password       string
	PrivateKey     string
	AuthorizedKeys []string
}

Jump to

Keyboard shortcuts

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