-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlrmp.go
47 lines (39 loc) · 873 Bytes
/
lrmp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package lrmp
import "errors"
var Version = "LRMP-1.4.2"
type Lrmp struct {
impl *impl
}
// create and join an LRMP session
func NewLrmp(addr string, port int, ttl int, network string, profile Profile) (*Lrmp, error) {
impl, err := newImpl(addr, port, ttl, network, profile)
if err != nil {
return nil, err
}
lrmp := Lrmp{impl}
return &lrmp, nil
}
func (l *Lrmp) Start() {
l.impl.startSession()
}
func (l *Lrmp) Stop() {
l.impl.stopSession()
}
func (l *Lrmp) Stats() Stats {
return l.impl.stats
}
func (l *Lrmp) DomainStats(scope int) DomainStats {
return l.impl.domainStats
}
func (l *Lrmp) WhoAmI() Entity {
return l.impl.whoAmI()
}
func (l *Lrmp) Send(packet *Packet) error {
if packet.GetDataLength() > packet.GetMaxDataLength() {
return errors.New("bad packet length")
}
return l.impl.send(packet)
}
func (l *Lrmp) Flush() {
l.impl.flush()
}