protocol

package
v0.0.0-...-312c3d0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version 版本号
	Version = "0.0.1"

	// TCPType TCP数据类型名
	TCPType = "tcp"
	// UDPType UDP数据类型名
	UDPType = "udp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Param

type Param struct {
	ListenIP    *string
	ListenPort  *int
	ForwardIP   *string
	ForwardPort *int
	Protocol    string
}

Param 参数结构体

func NewParam

func NewParam() *Param

NewParam 创建参数结构体

func ParaseParam

func ParaseParam() *Param

ParaseParam 收集命令行参数

type Server

type Server interface {
	Run() error
	Stop() error
}

Server 转发服务接口

func NewServer

func NewServer(param *Param) (ser Server)

NewServer 根据命令行参数创建不同的转发服务

func NewTCP

func NewTCP(param *Param) Server

NewTCP 创建TCP参数结构体

func NewUDP

func NewUDP(param *Param) Server

NewUDP 创建UDP参数结构体

type TCP

type TCP struct {
	Param *Param
}

TCP TCP转发服务所需参数结构体

func (*TCP) Run

func (s *TCP) Run() (err error)

Run 开始TCP转发服务

func (*TCP) Stop

func (s *TCP) Stop() error

Stop 停止TCP转发服务

type UDP

type UDP struct {
	Param *Param
}

UDP UDP转发服务所需参数结构体

func (*UDP) Run

func (s *UDP) Run() error

Run 开始UDP转发服务

func (*UDP) Stop

func (s *UDP) Stop() error

Stop 停止UDP转发服务

Jump to

Keyboard shortcuts

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