-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (27 loc) · 785 Bytes
/
main.go
File metadata and controls
36 lines (27 loc) · 785 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
34
35
36
/*
Laboratorio 6 - Web Proxy com Cache
Leandro Alves Vianna
Rafael de Castro Silva
*/
package main
import "fmt"
import "os"
import "os/signal"
import "github.com/leandrovianna/gowebproxy/info"
import "github.com/leandrovianna/gowebproxy/proxy"
func main() {
const webProxyPort = 54321
const infoPort = 54322
stats := make(chan info.Stats)
// inicia o servidor web proxy na porta 54321
go proxy.ProxyWebServer(webProxyPort, stats)
// inicia o servidor de infos na porta 54322
go info.InfoServer(infoPort, stats)
// capturar Ctrl-C (Interrupt Signal)
// para encerrar o programa
interruptChan := make(chan os.Signal, 1)
signal.Notify(interruptChan, os.Interrupt)
// bloqueia para manter as goroutines executando
<-interruptChan
fmt.Println("Server terminated.")
}