mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 02:34:02 +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 {
|
||||
rpcChan := make(chan Stats)
|
||||
statsChan <- rpcChan
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/9seconds/mtg/config"
|
||||
)
|
||||
|
||||
// Init initializes stats subsystem.
|
||||
func Init(conf *config.Config) error {
|
||||
if conf.StatsD.Enabled {
|
||||
client, err := newStatsd(conf)
|
||||
|
||||
@@ -89,6 +89,7 @@ func (s speed) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(value)
|
||||
}
|
||||
|
||||
// Stats represents a statistics of the proxy.
|
||||
type Stats struct {
|
||||
URLs config.IPURLs `json:"urls"`
|
||||
Connections connections `json:"connections"`
|
||||
@@ -165,6 +166,7 @@ func (s *Stats) handleCrash() {
|
||||
s.Crashes++
|
||||
}
|
||||
|
||||
// NewStats creates a new instance of Stats structure.
|
||||
func NewStats(conf *config.Config) *Stats {
|
||||
return &Stats{
|
||||
URLs: conf.GetURLs(),
|
||||
|
||||
Reference in New Issue
Block a user