-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
33 lines (22 loc) · 727 Bytes
/
Copy pathmain.go
File metadata and controls
33 lines (22 loc) · 727 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 main
import (
"flag"
"fmt"
"log"
"strings"
"github.com/cberez/chproxy/proxy"
)
func main() {
var addresses string
flag.StringVar(&addresses, "addresses", "localhost:9222", "comma separated list of chrome headless addresses")
var port string
flag.StringVar(&port, "port", "8080", "port to listen to for incoming connections")
var timeout int
flag.IntVar(&timeout, "timeouyt", 5, "connection timeout in seconds")
var apiKey string
flag.StringVar(&apiKey, "apikey", "key", "api key to use")
flag.Parse()
p := chproxy.Proxy{ApiKey: apiKey, Timeout: timeout, Addresses: strings.Split(addresses, ",")}
log.Printf("listening on port %s", port)
p.ServeAndHandle(fmt.Sprintf("localhost:%s", port))
}