mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 04:34:03 +03:00
Print URLs on start to stdout
This commit is contained in:
@@ -4,6 +4,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -119,6 +120,7 @@ func main() {
|
|||||||
|
|
||||||
stat := proxy.NewStats(*serverName, *portToShow, *secret)
|
stat := proxy.NewStats(*serverName, *portToShow, *secret)
|
||||||
go stat.Serve(*statsIP, *statsPort)
|
go stat.Serve(*statsIP, *statsPort)
|
||||||
|
printURLs(stat.URLs)
|
||||||
|
|
||||||
srv := proxy.NewServer(*bindIP, int(*bindPort), secretBytes, logger,
|
srv := proxy.NewServer(*bindIP, int(*bindPort), secretBytes, logger,
|
||||||
*readTimeout, *writeTimeout, *preferIPv6, stat)
|
*readTimeout, *writeTimeout, *preferIPv6, stat)
|
||||||
@@ -127,6 +129,17 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printURLs(data interface{}) {
|
||||||
|
encoder := json.NewEncoder(os.Stdout)
|
||||||
|
encoder.SetEscapeHTML(false)
|
||||||
|
encoder.SetIndent("", " ")
|
||||||
|
|
||||||
|
err := encoder.Encode(data)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func usage(msg string) {
|
func usage(msg string) {
|
||||||
io.WriteString(os.Stderr, msg+"\n")
|
io.WriteString(os.Stderr, msg+"\n")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user