mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 14:54:03 +03:00
Add comments for exported functions
This commit is contained in:
@@ -68,6 +68,7 @@ func EgressTraffic(traffic int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetStats returns a snapshot of Stats instance.
|
||||||
func GetStats() Stats {
|
func GetStats() Stats {
|
||||||
rpcChan := make(chan Stats)
|
rpcChan := make(chan Stats)
|
||||||
statsChan <- rpcChan
|
statsChan <- rpcChan
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/9seconds/mtg/config"
|
"github.com/9seconds/mtg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Init initializes stats subsystem.
|
||||||
func Init(conf *config.Config) error {
|
func Init(conf *config.Config) error {
|
||||||
if conf.StatsD.Enabled {
|
if conf.StatsD.Enabled {
|
||||||
client, err := newStatsd(conf)
|
client, err := newStatsd(conf)
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ func (s speed) MarshalJSON() ([]byte, error) {
|
|||||||
return json.Marshal(value)
|
return json.Marshal(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stats represents a statistics of the proxy.
|
||||||
type Stats struct {
|
type Stats struct {
|
||||||
URLs config.IPURLs `json:"urls"`
|
URLs config.IPURLs `json:"urls"`
|
||||||
Connections connections `json:"connections"`
|
Connections connections `json:"connections"`
|
||||||
@@ -165,6 +166,7 @@ func (s *Stats) handleCrash() {
|
|||||||
s.Crashes++
|
s.Crashes++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewStats creates a new instance of Stats structure.
|
||||||
func NewStats(conf *config.Config) *Stats {
|
func NewStats(conf *config.Config) *Stats {
|
||||||
return &Stats{
|
return &Stats{
|
||||||
URLs: conf.GetURLs(),
|
URLs: conf.GetURLs(),
|
||||||
|
|||||||
Reference in New Issue
Block a user