telebit/rvpn/connection/domain_track.go
Henry Camacho fc89682b9e updated to include domain stat traffic
- add support for domain_api container for JSON encoding
- separated server api containers out of the listener_admin
- added domain track to connection
- add extension to the send channel to identify domain associated to send bytes
- helper function for adding tracked domain
- implemented outbound byte counter for domain (inbound will come when we resolve the packer issues)
2017-02-15 20:06:26 -06:00

40 lines
708 B
Go

package connection
//DomainTrack -- Tracking specifics for domains
type DomainTrack struct {
DomainName string
bytesIn int64
bytesOut int64
}
//NewDomainTrack -- Constructor
func NewDomainTrack(domainName string) (p *DomainTrack) {
p = new(DomainTrack)
p.DomainName = domainName
p.bytesIn = 0
p.bytesOut = 0
return
}
//BytesIn -- Property
func (c *DomainTrack) BytesIn() (b int64) {
b = c.bytesIn
return
}
//BytesOut -- Property
func (c *DomainTrack) BytesOut() (b int64) {
b = c.bytesOut
return
}
//AddIn - Porperty
func (c *DomainTrack) AddIn(num int64) {
c.bytesIn = c.bytesIn + num
}
//AddOut -- Property
func (c *DomainTrack) AddOut(num int64) {
c.bytesOut = c.bytesOut + num
}