-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
event.go
60 lines (48 loc) · 1.26 KB
/
event.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
52
53
54
55
56
57
58
59
60
// Copyright 2022 Kirill Scherba <kirill@scherba.ru>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Teonet event module
package teonet
// Teonet event struct
type Event struct {
Event TeonetEventType
Err error
}
// Teonet event type
type TeonetEventType byte
// Teonet events
const (
EventNone TeonetEventType = iota
// Event when Teonet client initialized and start listen, Err = nil
EventTeonetInit
// Event when Connect to teonet r-host, Err = nil
EventTeonetConnected
// Event when Disconnect from teonet r-host, Err = dosconnect error
EventTeonetDisconnected
// Event when Connect to peer, Err = nil
EventConnected
// Event when Disconnect from peer, Err = dosconnect error
EventDisconnected
// Event when Data Received, Err = nil
EventData
)
// Event to string
func (e Event) String() (str string) {
switch e.Event {
case EventNone:
str = "EventNone"
case EventTeonetInit:
str = "EventTeonetInit"
case EventTeonetConnected:
str = "EventTeonetConnected"
case EventTeonetDisconnected:
str = "EventTeonetDisconnected"
case EventConnected:
str = "EventConnected"
case EventDisconnected:
str = "EventDisconnected"
case EventData:
str = "EventData"
}
return
}