cmd/discosrv: Fix lint warnings

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3275
This commit is contained in:
Jakob Borg 2016-06-07 07:33:11 +00:00
parent 4a69f3987f
commit b7e186b370
2 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ var (
certFile = "cert.pem"
keyFile = "key.pem"
debug = false
useHttp = false
useHTTP = false
)
func main() {
@ -76,14 +76,14 @@ func main() {
flag.StringVar(&certFile, "cert", certFile, "Certificate file")
flag.StringVar(&keyFile, "key", keyFile, "Key file")
flag.BoolVar(&debug, "debug", debug, "Debug")
flag.BoolVar(&useHttp, "http", useHttp, "Listen on HTTP (behind an HTTPS proxy)")
flag.BoolVar(&useHTTP, "http", useHTTP, "Listen on HTTP (behind an HTTPS proxy)")
flag.Parse()
log.Println(LongVersion)
var cert tls.Certificate
var err error
if !useHttp {
if !useHTTP {
cert, err = tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
log.Fatalln("Failed to load X509 key pair:", err)

View File

@ -83,7 +83,7 @@ func (s *querysrv) Serve() {
Cache: lru.New(lruSize),
}
if useHttp {
if useHTTP {
listener, err := net.Listen("tcp", s.addr)
if err != nil {
log.Println("Listen:", err)
@ -153,7 +153,7 @@ func (s *querysrv) handler(w http.ResponseWriter, req *http.Request) {
}()
var remoteIP net.IP
if useHttp {
if useHTTP {
remoteIP = net.ParseIP(req.Header.Get("X-Forwarded-For"))
} else {
addr, err := net.ResolveTCPAddr("tcp", req.RemoteAddr)