Documentation
¶
Index ¶
Constants ¶
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
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
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
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) 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