Add comments for exported functions

This commit is contained in:
9seconds
2018-10-17 10:51:16 +03:00
parent 358d42ec61
commit 3aec9657d7
3 changed files with 4 additions and 0 deletions
+1
View File
@@ -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
+1
View File
@@ -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)
+2
View File
@@ -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(),