-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.go
40 lines (33 loc) · 814 Bytes
/
common.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
package gxmpp
import (
)
/**
Some global struct and const defined here.
*/
type ServerConfig struct {
DebugEnable bool
C2SPort string //the port listen for the client-server
S2SEnable bool //not prepare implement yet
S2SPort string
UseTls bool
Host string //the server host. If don't want to valid it. Leave it alone.
TlsCertFile string
TlsKeyFile string
//default port 5223 listen the client use SSL connected in directly.
}
var emptyConfig ServerConfig
var _hasInited bool
func initDefaultConfig() {
emptyConfig.DebugEnable = true
emptyConfig.C2SPort = "0.0.0.0:5222"
emptyConfig.S2SEnable = false
emptyConfig.S2SPort = "0.0.0.0:5269"
emptyConfig.UseTls = false
emptyConfig.Host = ""
}
func DefaultConfig() *ServerConfig {
if !_hasInited {
initDefaultConfig()
}
return &emptyConfig
}