-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
65 lines (56 loc) · 1.09 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
package main
import (
"bufio"
"os"
"runtime"
"log"
"flag"
)
var urlTarget = "http://www.google.de"
var disableWeb bool
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
flag.BoolVar(&disableWeb, "disable-web", false, "Disable webserver")
flag.Parse()
if disableWeb {
Message("Clicker start (c) by Patrick Othmer", false)
voter()
} else {
go h.run()
loadIndex()
Message("Clicker start (c) by Patrick Othmer", false)
webServer()
}
}
func Message(message string, output bool) {
log.Printf("%s\n", message)
if !disableWeb && output {
h.broadcast <- []byte(message)
}
}
func readLines(path string) ([]string, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
defer file.Close()
var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
return lines, scanner.Err()
}
func handleNewProxys() {
go func() {
for {
select {
case proxy := <-addProxy:
if _, ok := proxyList[proxy]; !ok {
Message(proxy + "|Good proxy", true)
proxyList[proxy] = proxy
}
}
}
}()
}