-
Notifications
You must be signed in to change notification settings - Fork 5
/
znp.go
51 lines (42 loc) · 1012 Bytes
/
znp.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
48
49
50
51
package znp
import (
"github.com/dyrkin/unp-go"
"github.com/dyrkin/znp-go/request"
)
type Znp struct {
u *unp.Unp
outbound chan request.Outgoing
inbound chan *unp.Frame
asyncInbound chan interface{}
errors chan error
inFramesLog chan *unp.Frame
outFramesLog chan *unp.Frame
started bool
}
func New(u *unp.Unp) *Znp {
znp := &Znp{
u: u,
outbound: make(chan request.Outgoing),
inbound: make(chan *unp.Frame),
asyncInbound: make(chan interface{}),
errors: make(chan error, 100),
inFramesLog: make(chan *unp.Frame, 100),
outFramesLog: make(chan *unp.Frame, 100),
}
return znp
}
func (znp *Znp) Errors() chan error {
return znp.errors
}
func (znp *Znp) AsyncInbound() chan interface{} {
return znp.asyncInbound
}
func (znp *Znp) InFramesLog() chan *unp.Frame {
return znp.inFramesLog
}
func (znp *Znp) OutFramesLog() chan *unp.Frame {
return znp.outFramesLog
}
func (znp *Znp) IsStarted() bool {
return znp.started
}