worker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchController

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

func NewMatchController

func NewMatchController(rateByte int, statFunc func(int)) *MatchController

func (*MatchController) DealTransferConn

func (mc *MatchController) DealTransferConn(tc *TransferConn, timeout time.Duration) error

block until there is a same ID transfer conn or timeout

type Options

type Options struct {
	ServerAddr         string
	BindAddr           string
	AdvicePublicIP     string
	RateKB             int // xx KB/s
	MaxTrafficMBPerDay int // xx MB, 0 is no limit

	LogFile    string
	LogLevel   string
	LogMaxDays int64
}

func (*Options) Check

func (op *Options) Check() error

type Register

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

func NewRegister

func NewRegister(port int64, advicePublicIP string, serverAddr string) (*Register, error)

func (*Register) Close added in v0.2.0

func (r *Register) Close()

func (*Register) Register

func (r *Register) Register() error

func (*Register) Reset added in v0.2.0

func (r *Register) Reset()

Reset can be only called after Close

func (*Register) RunKeepAlive

func (r *Register) RunKeepAlive()

type Service

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

func NewService

func NewService(options Options) (*Service, error)

func (*Service) Run

func (svc *Service) Run() error

type TrafficLimiter added in v0.2.0

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

func NewTrafficLimiter added in v0.2.0

func NewTrafficLimiter(maxCountPerDay uint64, exceedLimitCallback func(), restoreCallback func()) *TrafficLimiter

func (*TrafficLimiter) AddCount added in v0.2.0

func (tl *TrafficLimiter) AddCount(count uint64)

func (*TrafficLimiter) Run added in v0.2.0

func (tl *TrafficLimiter) Run()

type TransferConn

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

func NewTransferConn

func NewTransferConn(id string, conn net.Conn, isSender bool) *TransferConn

Jump to

Keyboard shortcuts

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