/*
GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2017 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
package main
import (
- "log"
"net/http"
"cypherpunks.ru/govpn"
func (p proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
conn, _, err := w.(http.Hijacker).Hijack()
if err != nil {
- govpn.Println("Hijacking failed:", err.Error())
+ govpn.Printf(`[proxy-hijack-failed bind="%s" err="%s"]`, *bindAddr, err)
return
}
conn.Write([]byte("HTTP/1.0 200 OK\n\n"))
}
func proxyStart() {
- log.Println("HTTP proxy listening on:" + *proxy)
- govpn.Println("HTTP proxy listening on:" + *proxy)
+ govpn.BothPrintf(`[proxy-listen bind="%s" addr="%s"]`, *bindAddr, *proxy)
s := &http.Server{
Addr: *proxy,
Handler: proxyHandler{},
}
- log.Println("HTTP proxy result:", s.ListenAndServe())
- govpn.Println("HTTP proxy result:", s.ListenAndServe())
+ govpn.BothPrintf(`[proxy-finished bind="%s" result="%s"]`, *bindAddr, s.ListenAndServe())
}