-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhamgo.go
More file actions
33 lines (29 loc) · 752 Bytes
/
hamgo.go
File metadata and controls
33 lines (29 loc) · 752 Bytes
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
package hamgo
//New : create a Server by Properties
func New(properties *Properties) Server {
//set server by Properties
if properties != nil {
setLog(properties.LogFile)
setSession(properties.SessionMaxLifeTime)
} else {
setLog(defaultFilePath)
setSession(defaultSessionMaxTime)
}
//set logo
printLogo()
//return
return newServer()
}
//New : create a Server by config
func NewByConf(configFile string) Server {
//set server by config
setConfig(configFile)
return New(&Properties{"", Conf.DefaultInt("session_max_time", 0)})
}
func NewProperties(logFile string, sessionMaxLifeTime int) *Properties {
return &Properties{logFile, sessionMaxLifeTime}
}
type Properties struct {
LogFile string
SessionMaxLifeTime int
}