client

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateConfCmd = &cobra.Command{
	Use:     "cliconf",
	GroupID: "exec",
	Short:   "生成主机端的默认yaml配置文件",
	Run: func(cmd *cobra.Command, args []string) {
		CreateConfigFile(path)
	},

	Example: "portmap_linux_amd64 cliconf -p config.yaml",
}
View Source
var RunCmd = &cobra.Command{
	Use:     "clirun",
	GroupID: "exec",
	Short:   "执行主机端端口映射程序",
	Run: func(cmd *cobra.Command, args []string) {
		LoadConfigFromFile(confPath)
		instance := NewInstance(config)
		instance.Run()
	},

	Example: "portmap_linux_amd64 clirun -c config.yaml",
}

Functions

func CreateConfigFile

func CreateConfigFile(path string)

func LoadConfigFromFile

func LoadConfigFromFile(path string)

Types

type Instance

type Instance struct {
	CmdConn net.Conn
	// contains filtered or unexported fields
}

func NewInstance

func NewInstance(config InstanceConfig) *Instance

func (*Instance) ConnectToServer

func (i *Instance) ConnectToServer()

ConnectToServer 向服务器发起连接,并发送新主机密文 如果未能连接,将会不断重试,重试时间由配置文件指明

func (*Instance) Run

func (i *Instance) Run()

type InstanceConfig

type InstanceConfig struct {
	OutEndPoint    string `mapstructure:"outEndPoint"`
	ServerEndpoint string `mapstructure:"serverEndpoint"`
	Key            string `mapstructure:"key"`
	Password       string `mapstructure:"password"`
	RetryTime      int    `mapstructure:"retry"`
}

Jump to

Keyboard shortcuts

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