controller

package
v0.0.0-...-a9387a1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout = fmt.Errorf("timed out")
)

Functions

This section is empty.

Types

type CliDelegate

type CliDelegate interface {
	OnNewDC(port []int)
}

type Client

type Client struct {
	*Controller
	// contains filtered or unexported fields
}

func NewClient

func NewClient(f *flow.Flow, delegate CliDelegate, toDC packet.SendChan, fromDC packet.RecvChan, toTun chan<- []byte) *Client

func (*Client) GetFlow

func (c *Client) GetFlow() *flow.Flow

func (*Client) RequestNewDC

func (c *Client) RequestNewDC()

type Controller

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

func NewController

func NewController(f *flow.Flow, toDC packet.SendChan, fromDC packet.RecvChan) *Controller

func (*Controller) CancelAll

func (c *Controller) CancelAll()

func (*Controller) Close

func (c *Controller) Close()

func (*Controller) GetOutChan

func (c *Controller) GetOutChan() packet.RecvChan

func (*Controller) GetReqId

func (c *Controller) GetReqId() uint32

func (*Controller) Request

func (c *Controller) Request(req *packet.Packet) *packet.Packet

func (*Controller) Send

func (c *Controller) Send(req *packet.Packet)

func (*Controller) SendTimeout

func (c *Controller) SendTimeout(req *packet.Packet, timeout time.Duration) bool

func (*Controller) ShowStage

func (c *Controller) ShowStage() []StageInfo

func (*Controller) WriteChan

func (c *Controller) WriteChan() chan *Request

type Group

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

func NewGroup

func NewGroup(f *flow.Flow, delegate SvrDelegate, users *uc.Users, toTun chan<- []byte) *Group

func (*Group) OnDchanPortUpdate

func (c *Group) OnDchanPortUpdate(port []int)

func (*Group) RunDeliver

func (c *Group) RunDeliver(fromTun <-chan []byte)

func (*Group) UserLogin

func (c *Group) UserLogin(u *uc.User) *Server

type Queue

type Queue []*QueueItem

func NewQueue

func NewQueue(size int) Queue

func (Queue) Len

func (q Queue) Len() int

func (Queue) Less

func (q Queue) Less(i, j int) bool

func (*Queue) Push

func (q *Queue) Push(x interface{})

func (Queue) Swap

func (q Queue) Swap(i, j int)

type QueueItem

type QueueItem struct {
	Req  **Request
	Time time.Time
	// contains filtered or unexported fields
}

type Request

type Request struct {
	Packet  *packet.Packet
	Reply   chan *packet.Packet
	Timeout time.Duration
}

func NewRequest

func NewRequest(p *packet.Packet, reply bool) *Request

type Server

type Server struct {
	*Controller
	// contains filtered or unexported fields
}

func NewServer

func NewServer(f *flow.Flow, u *uc.User, toTun chan<- []byte) *Server

func (*Server) NotifyDataChannel

func (s *Server) NotifyDataChannel(port []int)

func (*Server) UserRelogin

func (s *Server) UserRelogin(u *uc.User)

type Stage

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

func (*Stage) Add

func (s *Stage) Add(p *Request)

func (*Stage) Pop

func (s *Stage) Pop(timeout time.Duration) *Request

func (*Stage) Remove

func (s *Stage) Remove(reqId uint32) (req *Request)

func (*Stage) ShowStage

func (s *Stage) ShowStage() []StageInfo

type StageInfo

type StageInfo struct {
	ReqId    uint32
	DataType packet.Type
}

type StageRequest

type StageRequest struct {
	Req  *Request
	Time time.Time
	Elem *list.Element
}

type SvrDelegate

type SvrDelegate interface {
	GetAllDataChannel() []int
}

Jump to

Keyboard shortcuts

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