]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/cmd/govpn-server/proxy.go
Forbid any later GNU GPL versions autousage
[govpn.git] / src / cypherpunks.ru / govpn / cmd / govpn-server / proxy.go
index f1f5e09d37aeec0558de8033cd361e2e595e9b62..68acf8c170f5922d7efbdd4deeaf8ea3d5e72b2f 100644 (file)
@@ -1,11 +1,10 @@
 /*
 GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2019 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
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,8 +18,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package main
 
 import (
-       "log"
        "net/http"
+
+       "cypherpunks.ru/govpn"
 )
 
 type proxyHandler struct{}
@@ -28,7 +28,7 @@ type proxyHandler struct{}
 func (p proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
        conn, _, err := w.(http.Hijacker).Hijack()
        if err != nil {
-               log.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"))
@@ -36,10 +36,10 @@ func (p proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 }
 
 func proxyStart() {
-       log.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.BothPrintf(`[proxy-finished bind="%s" result="%s"]`, *bindAddr, s.ListenAndServe())
 }