userclient

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateConfCmd = &cobra.Command{
	Use:     "userconf",
	GroupID: "exec",
	Short:   "生成用户端配置文件",
	Run: func(cmd *cobra.Command, args []string) {
		SaveExampleConf(savePath)
	},

	Example: "portmap_linux_amd64 userconf -p userconf.yaml",
}
View Source
var RunCmd = &cobra.Command{
	Use:     "userrun",
	GroupID: "exec",
	Short:   "运行用户端连接软件",
	Run: func(cmd *cobra.Command, args []string) {
		LoadFromPath(confPath)
		instance := NewInstance(config)
		instance.Run()
	},

	Example: "portmap_linux_amd64 userrun -c userconf.yaml",
}

Functions

func LoadFromPath

func LoadFromPath(path string)

LoadFromPath 是在 path 路径中读取配置文件

func SaveExampleConf

func SaveExampleConf(path string)

SaveExampleConf 是在 path 路径下保存示例配置文件

Types

type Config

type Config struct {
	// ServerTcpEndpoint 是连接服务器tcp的地址
	ServerTcpEndpoint string `mapstructure:"serverTcpEndpoint"`

	// ServerUdpEndpoint  是连接服务器udp的地址
	ServerUdpEndpoint string `mapstructure:"serverUdpEndpoint"`

	// ListenPort 是本地监听的端口
	ListenPort int `mapstructure:"listenPort"`
}

type Instance

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

func NewInstance

func NewInstance(config Config) *Instance

NewInstance 返回一个用户流量转发实例

func (*Instance) Run

func (i *Instance) Run()

Run 将运行该用户转发实例,当该示例正常运行时,会一直阻塞,直到发生错误

type UdpBlock

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

Jump to

Keyboard shortcuts

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