mirror of
https://github.com/therootcompany/telebit.git
synced 2025-12-25 14:58:46 +00:00
- 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)
40 lines
708 B
Go
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
|
|
}
|