app

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InputCmdOpt int = iota
	InputCmdServer
	InputCmdGroupPrefix
)

Variables

View Source
var (
	Version string
	Build   string
)

Functions

func Run

func Run()

Types

type Config

type Config struct {
	ShowDetail bool                   `json:"show_detail"`
	Servers    []*Server              `json:"servers"`
	Groups     []*Group               `json:"groups"`
	Options    map[string]interface{} `json:"options"`
	// contains filtered or unexported fields
}

type Cp

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

type FileLike

type FileLike interface {
	Name() string
	Stat() (os.FileInfo, error)
	Read([]byte) (int, error)
	Close() error
	Write(p []byte) (n int, err error)
}

type Group

type Group struct {
	GroupName string   `json:"group_name"`
	Prefix    string   `json:"prefix"`
	Servers   []Server `json:"servers"`
	Collapse  bool     `json:"collapse"`
	Proxy     *Proxy   `json:"proxy"`
}

type IOClient

type IOClient interface {
	Stat(file string) (os.FileInfo, error)
	Mkdir(path string) error
	Create(file string) (FileLike, error)
	Open(file string) (FileLike, error)
	ReadDir(file string) ([]os.FileInfo, error)
}

type IOClientType

type IOClientType int

type IndexType

type IndexType int
const (
	IndexTypeServer IndexType = iota
	IndexTypeGroup
)

type LocalIOClient

type LocalIOClient struct {
}

Local

func (*LocalIOClient) Create

func (client *LocalIOClient) Create(file string) (FileLike, error)

func (*LocalIOClient) Mkdir

func (client *LocalIOClient) Mkdir(path string) error

func (*LocalIOClient) Open

func (client *LocalIOClient) Open(file string) (FileLike, error)

func (*LocalIOClient) ReadDir

func (client *LocalIOClient) ReadDir(file string) ([]os.FileInfo, error)

func (*LocalIOClient) Stat

func (client *LocalIOClient) Stat(file string) (os.FileInfo, error)

type LogMode

type LogMode string
const (
	LogModeCover  LogMode = "cover"
	LogModeAppend LogMode = "append"
)

type Operation

type Operation struct {
	Key     string
	Label   string
	End     bool
	Process func(cfg *Config, args []string) error
}

type Proxy

type Proxy struct {
	Type     ProxyType `json:"type"`
	Server   string    `json:"server"`
	Port     int       `json:"port"`
	User     string    `json:"user"`
	Password string    `json:"password"`
}

type ProxyType

type ProxyType string
const (
	ProxyTypeSocks5 ProxyType = "SOCKS5"
)

type ResType

type ResType int
const (
	ResTypeSrc ResType = iota
	ResTypeDst
)

type Server

type Server struct {
	Name     string                 `json:"name"`
	Ip       string                 `json:"ip"`
	Port     int                    `json:"port"`
	User     string                 `json:"user"`
	Password string                 `json:"password"`
	Method   string                 `json:"method"`
	Key      string                 `json:"key"`
	Options  map[string]interface{} `json:"options"`
	Alias    string                 `json:"alias"`
	Log      ServerLog              `json:"log"`
	Term     string                 `json:"term"`
	// contains filtered or unexported fields
}

func (*Server) Connect

func (server *Server) Connect() error

执行远程连接

func (*Server) Edit

func (server *Server) Edit() error

编辑

func (*Server) Format

func (server *Server) Format()

格式化,赋予默认值

func (*Server) FormatPrint

func (server *Server) FormatPrint(flag string, ShowDetail bool) string

格式化输出,用于打印

func (*Server) GetSftpClient

func (server *Server) GetSftpClient() (*sftp.Client, error)

生成Sftp Client

func (*Server) GetSshClient

func (server *Server) GetSshClient() (*ssh.Client, error)

生成SSH Client

func (*Server) MergeOptions

func (server *Server) MergeOptions(options map[string]interface{}, overwrite bool)

合并选项

type ServerIndex

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

type ServerLog

type ServerLog struct {
	Enable   bool    `json:"enable"`
	Filename string  `json:"filename"`
	Mode     LogMode `json:"mode"`
}

type SftpIOClient

type SftpIOClient struct {
	SftpClient *sftp.Client
}

SFTP(Remote)

func (*SftpIOClient) Create

func (client *SftpIOClient) Create(file string) (FileLike, error)

func (*SftpIOClient) Mkdir

func (client *SftpIOClient) Mkdir(path string) error

func (*SftpIOClient) Open

func (client *SftpIOClient) Open(file string) (FileLike, error)

func (*SftpIOClient) ReadDir

func (client *SftpIOClient) ReadDir(file string) ([]os.FileInfo, error)

func (*SftpIOClient) Stat

func (client *SftpIOClient) Stat(file string) (os.FileInfo, error)

type TransferObject

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

type Upgrade

type Upgrade struct {
	Version string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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