file

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Cnf       *Config
	Id        int        //id
	VerifyKey string     //验证密钥
	Addr      string     //客户端ip地址
	Remark    string     //备注
	Status    bool       //是否开启
	IsConnect bool       //是否连接
	RateLimit int        //速度限制 /kb
	Flow      *Flow      //流量
	Rate      *rate.Rate //速度控制

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Client) GetId

func (s *Client) GetId() int

type Config

type Config struct {
	U              string //socks5验证用户名
	P              string //socks5验证密码
	Compress       string //压缩方式
	Crypt          bool   //是否加密
	CompressEncode int    //加密方式
	CompressDecode int    //解密方式
}

func DeepCopyConfig

func DeepCopyConfig(c *Config) *Config

深拷贝Config

type Csv

type Csv struct {
	Tasks            []*Tunnel
	Path             string
	Hosts            []*Host   //域名列表
	Clients          []*Client //客户端
	RunPath          string    //存储根目录
	ClientIncreaseId int       //客户端id
	TaskIncreaseId   int       //任务自增ID
	sync.Mutex
}
var (
	CsvDb *Csv
)

func GetCsvDb

func GetCsvDb() *Csv

init csv from file

func NewCsv

func NewCsv(runPath string) *Csv

func (*Csv) DelClient

func (s *Csv) DelClient(id int) error

func (*Csv) DelHost

func (s *Csv) DelHost(host string) error

func (*Csv) DelTask

func (s *Csv) DelTask(id int) error

func (*Csv) GetClient

func (s *Csv) GetClient(id int) (v *Client, err error)

func (*Csv) GetClientId

func (s *Csv) GetClientId() int

func (*Csv) GetClientList

func (s *Csv) GetClientList(start, length int) ([]*Client, int)

func (*Csv) GetHost

func (s *Csv) GetHost(start, length int, id int) ([]*Host, int)

func (*Csv) GetIdByVerifyKey

func (s *Csv) GetIdByVerifyKey(vKey string, addr string) (int, error)

func (*Csv) GetTask

func (s *Csv) GetTask(id int) (v *Tunnel, err error)

func (*Csv) GetTaskId

func (s *Csv) GetTaskId() int

func (*Csv) Init

func (s *Csv) Init()

func (*Csv) LoadClientFromCsv

func (s *Csv) LoadClientFromCsv()

func (*Csv) LoadHostFromCsv

func (s *Csv) LoadHostFromCsv()

func (*Csv) LoadTaskFromCsv

func (s *Csv) LoadTaskFromCsv()

func (*Csv) NewClient

func (s *Csv) NewClient(c *Client)

func (*Csv) NewHost

func (s *Csv) NewHost(t *Host)

func (*Csv) NewTask

func (s *Csv) NewTask(t *Tunnel)

func (*Csv) StoreClientsToCsv

func (s *Csv) StoreClientsToCsv()

func (*Csv) StoreHostToCsv

func (s *Csv) StoreHostToCsv()

func (*Csv) StoreTasksToCsv

func (s *Csv) StoreTasksToCsv()

func (*Csv) UpdateClient

func (s *Csv) UpdateClient(t *Client) error

func (*Csv) UpdateHost

func (s *Csv) UpdateHost(t *Host) error

func (*Csv) UpdateTask

func (s *Csv) UpdateTask(t *Tunnel) error

type Flow

type Flow struct {
	ExportFlow int64 //出口流量
	InletFlow  int64 //入口流量
	FlowLimit  int64 //流量限制,出口+入口 /M
	sync.RWMutex
}

func (*Flow) Add

func (s *Flow) Add(in, out int)

type Host

type Host struct {
	Host         string //启动方式
	Target       string //目标
	HeaderChange string //host修改
	HostChange   string //host修改
	Flow         *Flow
	Client       *Client
	Remark       string //备注
	NowIndex     int
	TargetArr    []string
	sync.RWMutex
}

func (*Host) GetRandomTarget

func (s *Host) GetRandomTarget() string

type Tunnel

type Tunnel struct {
	Id           int     //Id
	TcpPort      int     //服务端监听端口
	Mode         string  //启动方式
	Target       string  //目标
	Status       bool    //是否开启
	Client       *Client //所属客户端id
	Flow         *Flow
	Config       *Config
	UseClientCnf bool   //是否继承客户端配置
	Remark       string //备注
}

Jump to

Keyboard shortcuts

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