X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fcmd%2Fgovpn-server%2Fproxy.go;h=87e3455e13b700d5ce288791f83744816e44d368;hb=572cac17bde738055312f7a468a0bde0e760a262;hp=f1f5e09d37aeec0558de8033cd361e2e595e9b62;hpb=cecb63f12f4a9f523276a0c19c7feb7437c7f53a;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-server/proxy.go b/src/cypherpunks.ru/govpn/cmd/govpn-server/proxy.go index f1f5e09..87e3455 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-server/proxy.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-server/proxy.go @@ -1,6 +1,6 @@ /* GoVPN -- simple secure free software virtual private network daemon -Copyright (C) 2014-2016 Sergey Matveev +Copyright (C) 2014-2017 Sergey Matveev 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 @@ -19,8 +19,9 @@ along with this program. If not, see . package main import ( - "log" "net/http" + + "cypherpunks.ru/govpn" ) type proxyHandler struct{} @@ -28,7 +29,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 +37,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()) }