worker

package
v0.0.0-...-a139706 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxIdleConns        int = 10
	MaxIdleConnsPerHost int = 10
	IdleConnTimeout     int = 90
)

Network Const

Variables

This section is empty.

Functions

This section is empty.

Types

type RayAgent

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

RayAgent instance

func NewRayAgent

func NewRayAgent(wg *sync.WaitGroup) *RayAgent

NewRayAgent return a rayagent

func (*RayAgent) Start

func (r *RayAgent) Start()

Start start a rayagent

func (*RayAgent) Stop

func (r *RayAgent) Stop()

Stop stop a rayagent

type ServiceHandler

type ServiceHandler struct {
	NodeID   uint64
	NodeInfo *models.Node
	Tag      string

	Services        []models.Service
	ServicesChannel <-chan []models.Service
	WaitGroup       *sync.WaitGroup
	// contains filtered or unexported fields
}

ServiceHandler is a handler controls incoming services info and talk to v2ray through handlerServiceClient

func NewServiceHandler

func NewServiceHandler(nodeID uint64,
	nodeInfo *models.Node,
	hc modules.HandlerServiceClient,
	schan <-chan []models.Service) *ServiceHandler

NewServiceHandler return a pointer to service handler using provided info

func (*ServiceHandler) Start

func (h *ServiceHandler) Start()

Start start a instance

func (*ServiceHandler) Stop

func (h *ServiceHandler) Stop()

Stop stop a instance

type ServicePoller

type ServicePoller struct {
	RayDashURL     string // e.g. https://raydash.example.com
	Interval       uint64 // interval in second
	Ticker         *time.Ticker
	ServiceChannel chan<- []models.Service
	WaitGroup      *sync.WaitGroup
	// contains filtered or unexported fields
}

ServicePoller get services from raydash

func NewServicePoller

func NewServicePoller(url string, interval uint64, schan chan<- []models.Service) *ServicePoller

NewServicePoller return a new ServicePoller with private sub set

func (*ServicePoller) GetNodeInfo

func (c *ServicePoller) GetNodeInfo(nodeID uint64) (*models.Node, error)

GetNodeInfo is a general func retrieve node info from /nodes/:id

func (*ServicePoller) Start

func (c *ServicePoller) Start()

Start start a instance

func (*ServicePoller) Stop

func (c *ServicePoller) Stop()

Stop stop a instance

type StatsHandler

type StatsHandler struct {
	NodeID   uint64
	NodeInfo *models.Node

	Ticker       *time.Ticker
	Interval     uint64 // interval in second
	StatsChannel chan *models.Stats
	WaitGroup    *sync.WaitGroup
	// contains filtered or unexported fields
}

StatsHandler is a handler get traffic stats from v2ray and report back to raydash

func NewStatsHandler

func NewStatsHandler(sc *modules.StatsServiceClient) *StatsHandler

NewStatsHandler returns a ptr of StatsHandler instance

func (*StatsHandler) Start

func (s *StatsHandler) Start()

Start start statshandler instance

func (*StatsHandler) Stop

func (s *StatsHandler) Stop()

Stop do graceful shutdown and close the goroutine

type StatsSender

type StatsSender struct {
	RayDashURL string // e.g. https://raydash.example.com
	Interval   uint64 // interval in second
	Ticker     *time.Ticker

	StatsChannel chan *models.Stats
	WaitGroup    *sync.WaitGroup
	// contains filtered or unexported fields
}

StatsSender receive stats struct from channel and send it to raydash

func NewStatsSender

func NewStatsSender() *StatsSender

NewStatsSender returns a ptr of StatsSender instance

func (*StatsSender) Start

func (s *StatsSender) Start()

Start start the instance

func (*StatsSender) Stop

func (s *StatsSender) Stop()

Stop stop the instance

Jump to

Keyboard shortcuts

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