|
|
@@ -4,6 +4,7 @@ package main
|
|
4
|
4
|
|
|
5
|
5
|
import (
|
|
6
|
6
|
"encoding/hex"
|
|
|
7
|
+ "encoding/json"
|
|
7
|
8
|
"io"
|
|
8
|
9
|
"io/ioutil"
|
|
9
|
10
|
"net/http"
|
|
|
@@ -119,6 +120,7 @@ func main() {
|
|
119
|
120
|
|
|
120
|
121
|
stat := proxy.NewStats(*serverName, *portToShow, *secret)
|
|
121
|
122
|
go stat.Serve(*statsIP, *statsPort)
|
|
|
123
|
+ printURLs(stat.URLs)
|
|
122
|
124
|
|
|
123
|
125
|
srv := proxy.NewServer(*bindIP, int(*bindPort), secretBytes, logger,
|
|
124
|
126
|
*readTimeout, *writeTimeout, *preferIPv6, stat)
|
|
|
@@ -127,6 +129,17 @@ func main() {
|
|
127
|
129
|
}
|
|
128
|
130
|
}
|
|
129
|
131
|
|
|
|
132
|
+func printURLs(data interface{}) {
|
|
|
133
|
+ encoder := json.NewEncoder(os.Stdout)
|
|
|
134
|
+ encoder.SetEscapeHTML(false)
|
|
|
135
|
+ encoder.SetIndent("", " ")
|
|
|
136
|
+
|
|
|
137
|
+ err := encoder.Encode(data)
|
|
|
138
|
+ if err != nil {
|
|
|
139
|
+ panic(err)
|
|
|
140
|
+ }
|
|
|
141
|
+}
|
|
|
142
|
+
|
|
130
|
143
|
func usage(msg string) {
|
|
131
|
144
|
io.WriteString(os.Stderr, msg+"\n")
|
|
132
|
145
|
os.Exit(1)
|