-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
80 lines (66 loc) · 2.39 KB
/
main.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package gotox
/* gotox - a go wrapper for toxcore
*
* This work is based on the great work by organ
* (https://github.com/organ/golibtox).
*
* Pull requests, bug reporting and feature request (via github issues) are
* always welcome. :)
*
* For a list of supported toxcore features see PROGRESS.md.
*/
//#cgo LDFLAGS: -ltoxcore
//#include <tox/tox.h>
import "C"
import "sync"
/* Tox is the main struct. */
type Tox struct {
cOptions *C.struct_Tox_Options
tox *C.Tox
mtx sync.Mutex
// Callbacks
onSelfConnectionStatusChanges OnSelfConnectionStatusChanges
onFriendNameChanges OnFriendNameChanges
onFriendStatusMessageChanges OnFriendStatusMessageChanges
onFriendStatusChanges OnFriendStatusChanges
onFriendConnectionStatusChanges OnFriendConnectionStatusChanges
onFriendTypingChanges OnFriendTypingChanges
onFriendReadReceipt OnFriendReadReceipt
onFriendRequest OnFriendRequest
onFriendMessage OnFriendMessage
onFileRecvControl OnFileRecvControl
onFileChunkRequest OnFileChunkRequest
onFileRecv OnFileRecv
onFileRecvChunk OnFileRecvChunk
onFriendLossyPacket OnFriendLossyPacket
onFriendLosslessPacket OnFriendLosslessPacket
}
type Options struct {
/* The type of socket to create.
* If IPv6Enabled is true, both IPv6 and IPv4 connections are allowed.
*/
IPv6Enabled bool
/* Enable the use of UDP communication when available.
*
* Setting this to false will force Tox to use TCP only. Communications will
* need to be relayed through a TCP relay node, potentially slowing them down.
* Disabling UDP support is necessary when using anonymous proxies or Tor.
*/
UDPEnabled bool
/* The type of the proxy (PROXY_TYPE_NONE, PROXY_TYPE_HTTP or PROXY_TYPE_SOCKS5). */
ProxyType ToxProxyType
/* The IP address or DNS name of the proxy to be used. */
ProxyHost string
/* The port to use to connect to the proxy server. */
ProxyPort uint16
/* The start port of the inclusive port range to attempt to use. */
StartPort uint16
/* The end port of the inclusive port range to attempt to use. */
EndPort uint16
/* The port to use for the TCP server. If 0, the tcp server is disabled. */
TcpPort uint16
/* The type of savedata to load from. */
SaveDataType ToxSaveDataType
/* The savedata. */
SaveData []byte
}