server

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPublicAddr = errors.New("no public address")
)

Functions

This section is empty.

Types

type MatchController

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

func NewMatchController

func NewMatchController() *MatchController

func (*MatchController) DealRecvConn

func (mc *MatchController) DealRecvConn(rc *RecvConn) (filename string, fsize int64, cacheCount int64, err error)

func (*MatchController) DealSendConn

func (mc *MatchController) DealSendConn(sc *SendConn, timeout time.Duration) (cacheCount int64, err error)

block until there is a same ID recv conn or timeout

type Options

type Options struct {
	BindAddr string

	LogFile    string
	LogLevel   string
	LogMaxDays int64
}

func (*Options) Check

func (op *Options) Check() error

type RecvConn

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

func NewRecvConn

func NewRecvConn(id string, conn net.Conn, cacheCount int64) *RecvConn

type SendConn

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

func NewSendConn

func NewSendConn(id string, conn net.Conn, filename string, fsize int64, cacheCount int64) *SendConn

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 Worker

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

func NewWorker

func NewWorker(port int64, advicePublicIP string, conn net.Conn) *Worker

func (*Worker) DetectPublicAddr

func (w *Worker) DetectPublicAddr() error

func (*Worker) PublicAddr

func (w *Worker) PublicAddr() string

func (*Worker) RunKeepAlive

func (w *Worker) RunKeepAlive(closeCallback func())

type WorkerGroup

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

func NewWorkerGroup

func NewWorkerGroup() *WorkerGroup

func (*WorkerGroup) GetAvailableWorkerAddrs

func (wg *WorkerGroup) GetAvailableWorkerAddrs() []string

func (*WorkerGroup) RegisterWorker

func (wg *WorkerGroup) RegisterWorker(w *Worker)

Jump to

Keyboard shortcuts

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