Просмотр исходного кода

Changed log line format for local proxy ports to simplify parsing

Rod Hynes 11 лет назад
Родитель
Сommit
87a469bbee

+ 3 - 3
AndroidApp/app/src/main/java/ca/psiphon/psibot/Psiphon.java

@@ -173,9 +173,9 @@ public class Psiphon extends Psi.PsiphonProvider.Stub {
     }
 
     private synchronized void parseMessage(String message) {
-        // TODO: this is based on temporary log line formats
-        final String socksProxy = "SOCKS-PROXY local SOCKS proxy running at address 127.0.0.1:";
-        final String httpProxy = "HTTP-PROXY local HTTP proxy running at address 127.0.0.1:";
+        // TODO: this is based on tentative log line formats
+        final String socksProxy = "SOCKS-PROXY-PORT ";
+        final String httpProxy = "HTTP-PROXY-PORT ";
         final String homePage = "HOMEPAGE ";
         final String tunnelStarted = "TUNNELS 1";
         int index;

+ 2 - 2
psiphon/httpProxy.go

@@ -66,7 +66,7 @@ func NewHttpProxy(config *Config, tunneler Tunneler) (proxy *HttpProxy, err erro
 	}
 	proxy.serveWaitGroup.Add(1)
 	go proxy.serve()
-	Notice(NOTICE_HTTP_PROXY, "local HTTP proxy running at address %s", proxy.listener.Addr().String())
+	Notice(NOTICE_HTTP_PROXY_PORT, "%d", proxy.listener.Addr().(*net.TCPAddr).Port)
 	return proxy, nil
 }
 
@@ -240,5 +240,5 @@ func (proxy *HttpProxy) serve() {
 			Notice(NOTICE_ALERT, "%s", ContextError(err))
 		}
 	}
-	Notice(NOTICE_HTTP_PROXY, "HTTP proxy stopped")
+	Notice(NOTICE_INFO, "HTTP proxy stopped")
 }

+ 10 - 10
psiphon/notice.go

@@ -25,16 +25,16 @@ import (
 )
 
 const (
-	NOTICE_INFO            = "INFO"
-	NOTICE_ALERT           = "ALERT"
-	NOTICE_VERSION         = "VERSION"
-	NOTICE_TUNNELS         = "TUNNELS"
-	NOTICE_SOCKS_PROXY     = "SOCKS-PROXY"
-	NOTICE_HTTP_PROXY      = "HTTP-PROXY"
-	NOTICE_UPGRADE         = "UPGRADE"
-	NOTICE_HOMEPAGE        = "HOMEPAGE"
-	NOTICE_PAGE_VIEW_REGEX = "PAGE-VIEW-REGEX"
-	NOTICE_HTTPS_REGEX     = "HTTPS-REGEX"
+	NOTICE_INFO             = "INFO"
+	NOTICE_ALERT            = "ALERT"
+	NOTICE_VERSION          = "VERSION"
+	NOTICE_TUNNELS          = "TUNNELS"
+	NOTICE_SOCKS_PROXY_PORT = "SOCKS-PROXY_PORT"
+	NOTICE_HTTP_PROXY_PORT  = "HTTP-PROXY-PORT"
+	NOTICE_UPGRADE          = "UPGRADE"
+	NOTICE_HOMEPAGE         = "HOMEPAGE"
+	NOTICE_PAGE_VIEW_REGEX  = "PAGE-VIEW-REGEX"
+	NOTICE_HTTPS_REGEX      = "HTTPS-REGEX"
 )
 
 func Notice(prefix, format string, args ...interface{}) {

+ 2 - 2
psiphon/socksProxy.go

@@ -56,7 +56,7 @@ func NewSocksProxy(config *Config, tunneler Tunneler) (proxy *SocksProxy, err er
 	}
 	proxy.serveWaitGroup.Add(1)
 	go proxy.serve()
-	Notice(NOTICE_SOCKS_PROXY, "local SOCKS proxy running at address %s", proxy.listener.Addr().String())
+	Notice(NOTICE_SOCKS_PROXY_PORT, "%d", proxy.listener.Addr().(*net.TCPAddr).Port)
 	return proxy, nil
 }
 
@@ -118,5 +118,5 @@ loop:
 			}
 		}()
 	}
-	Notice(NOTICE_SOCKS_PROXY, "SOCKS proxy stopped")
+	Notice(NOTICE_INFO, "SOCKS proxy stopped")
 }