-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
65 lines (59 loc) · 1.3 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
package main
import (
"log"
"net"
"net/http"
unciv "github.com/eyedeekay/soap/lib"
onramp "github.com/eyedeekay/onramp"
sam3 "github.com/eyedeekay/sam3"
)
func main() {
ucs := &unciv.UncivServer{}
//listener
garlic1, err := onramp.NewGarlic("unciv", "127.0.0.1:7656", sam3.Options_Wide)
if err != nil {
panic(err)
}
//ln, err := garlic.ListenTLS()
ln, err := garlic1.Listen()
if err != nil {
panic(err)
}
log.Printf("Multiplayer Unciv Server listening on:\n\t%s", ln.Addr().String())
defer ln.Close()
fs := &unciv.FrontServer{
PageTitle: "Unciv Server",
ServerName: "Default Server",
Description: "TODO",
TOS: "TODO",
URL: ln.Addr().String(),
}
go func() {
garlic2, err := onramp.NewGarlic("unciv-display", "127.0.0.1:7656", sam3.Options_Wide)
if err != nil {
panic(err)
}
fsln, err := garlic2.Listen()
if err != nil {
panic(err)
}
log.Printf("Unciv Server sharing server:\n\t%s", fsln.Addr().String())
defer fsln.Close()
if err := http.Serve(fsln, fs); err != nil {
panic(err)
}
}()
go func() {
fsln, err := net.Listen("tcp", "127.0.0.1:7699")
if err != nil {
panic(err)
}
defer fsln.Close()
if err := http.Serve(fsln, fs); err != nil {
panic(err)
}
}()
if err := http.Serve(ln, ucs); err != nil {
panic(err)
}
}