forked from tunnel-collections/go-tun2socks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
59 lines (54 loc) · 1.39 KB
/
errors.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
package core
// Error codes defined in lwIP.
// /** Definitions for error constants. */
// typedef enum {
// /** No error, everything OK. */
// ERR_OK = 0,
// /** Out of memory error. */
// ERR_MEM = -1,
// /** Buffer error. */
// ERR_BUF = -2,
// /** Timeout. */
// ERR_TIMEOUT = -3,
// /** Routing problem. */
// ERR_RTE = -4,
// /** Operation in progress */
// ERR_INPROGRESS = -5,
// /** Illegal value. */
// ERR_VAL = -6,
// /** Operation would block. */
// ERR_WOULDBLOCK = -7,
// /** Address in use. */
// ERR_USE = -8,
// /** Already connecting. */
// ERR_ALREADY = -9,
// /** Conn already established.*/
// ERR_ISCONN = -10,
// /** Not connected. */
// ERR_CONN = -11,
// /** Low-level netif error */
// ERR_IF = -12,
//
// /** Connection aborted. */
// ERR_ABRT = -13,
// /** Connection reset. */
// ERR_RST = -14,
// /** Connection closed. */
// ERR_CLSD = -15,
// /** Illegal argument. */
// ERR_ARG = -16
// } err_enum_t;
const (
LWIP_ERR_OK int = iota
LWIP_ERR_ABRT
LWIP_ERR_CONN
)
type lwipError struct {
Code int
}
func NewLWIPError(code int) error {
return &lwipError{Code: code}
}
func (e *lwipError) Error() string {
return "error code " + string(e.Code)
}