-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (29 loc) · 870 Bytes
/
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
package main
import (
"flag"
"fmt"
"os"
)
type Options struct {
maxConnections int
whitelistedClients string
blacklistedIps string
}
func configure(options Options) {
if _, err := os.Stat(options.whitelistedClients); err == nil {
fmt.Println("Loading whitelisted clients:", options.whitelistedClients)
} else {
fmt.Println("Skipping whitelisted clients")
}
}
func main() {
maxConnectionsPtr := flag.Int("max-connections", 20, "Max number of TCP connections.")
whitelistedClientsPtr := flag.String("whitelisted-clients", "", "Whitelist of client types.")
blacklistedIpsPtr := flag.String("blacklisted-ips", "", "Blacklisted IPs.")
flag.Parse()
options := Options{maxConnections: *maxConnectionsPtr,
whitelistedClients: *whitelistedClientsPtr,
blacklistedIps: *blacklistedIpsPtr}
configure(options)
SetupRoutesAndStartServer()
}