mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 15:44:01 +03:00
Print URLs on start to stdout
This commit is contained in:
@@ -4,6 +4,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -119,6 +120,7 @@ func main() {
|
||||
|
||||
stat := proxy.NewStats(*serverName, *portToShow, *secret)
|
||||
go stat.Serve(*statsIP, *statsPort)
|
||||
printURLs(stat.URLs)
|
||||
|
||||
srv := proxy.NewServer(*bindIP, int(*bindPort), secretBytes, logger,
|
||||
*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) {
|
||||
io.WriteString(os.Stderr, msg+"\n")
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user