This is an automated email from the git hooks/post-receive script.
itchyonion pushed a change to branch main in repository pluggable-transports/snowflake.
from 2f55581 Reduce the smux KeepAliveTimeout on the server from 10 to 4 minutes. new 768b80d Use event logger for proxy starting message and NAT info new 9d72b30 proxy: Let verbose level act on file logging
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: common/event/interface.go | 17 +++++++++++++++++ proxy/lib/pt_event_logger.go | 2 ++ proxy/lib/snowflake.go | 4 ++-- proxy/main.go | 11 +++++++---- 4 files changed, 28 insertions(+), 6 deletions(-)
This is an automated email from the git hooks/post-receive script.
itchyonion pushed a commit to branch main in repository pluggable-transports/snowflake.
commit 768b80dbdfba8733a614770c93fdbea4d48c7c52 Author: itchyonion itchyonion@torproject.org AuthorDate: Mon Nov 7 15:20:20 2022 -0800
Use event logger for proxy starting message and NAT info --- common/event/interface.go | 17 +++++++++++++++++ proxy/lib/pt_event_logger.go | 2 ++ proxy/lib/snowflake.go | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/common/event/interface.go b/common/event/interface.go index 968b270..64132e0 100644 --- a/common/event/interface.go +++ b/common/event/interface.go @@ -58,6 +58,14 @@ func (e EventOnSnowflakeConnectionFailed) String() string { return fmt.Sprintf("trying a new proxy: %s", scrubbed) }
+type EventOnProxyStarting struct { + SnowflakeEvent +} + +func (e EventOnProxyStarting) String() string { + return "Proxy starting" +} + type EventOnProxyConnectionOver struct { SnowflakeEvent InboundTraffic int @@ -68,6 +76,15 @@ func (e EventOnProxyConnectionOver) String() string { return fmt.Sprintf("Proxy connection closed (↑ %d, ↓ %d)", e.InboundTraffic, e.OutboundTraffic) }
+type EventOnCurrentNATTypeDetermined struct { + SnowflakeEvent + CurNATType string +} + +func (e EventOnCurrentNATTypeDetermined) String() string { + return fmt.Sprintf("NAT type: %v", e.CurNATType) +} + type SnowflakeEventReceiver interface { // OnNewSnowflakeEvent notify receiver about a new event // This method MUST not block diff --git a/proxy/lib/pt_event_logger.go b/proxy/lib/pt_event_logger.go index cb262e4..b16f5ba 100644 --- a/proxy/lib/pt_event_logger.go +++ b/proxy/lib/pt_event_logger.go @@ -33,6 +33,8 @@ func (p *logEventLogger) OnNewSnowflakeEvent(e event.SnowflakeEvent) { p.inboundSum += e.InboundTraffic p.outboundSum += e.OutboundTraffic p.connectionCount += 1 + default: + p.logger.Println(e.String()) } }
diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index f8a0f2c..b4ca5c3 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -566,7 +566,7 @@ func (sf *SnowflakeProxy) runSession(sid string) { func (sf *SnowflakeProxy) Start() error { var err error
- log.Println("starting") + sf.EventDispatcher.OnNewSnowflakeEvent(event.EventOnProxyStarting{}) sf.shutdown = make(chan struct{})
// blank configurations revert to default @@ -621,7 +621,7 @@ func (sf *SnowflakeProxy) Start() error {
currentNATTypeLoaded := getCurrentNATType()
- log.Printf("NAT type: %s", currentNATTypeLoaded) + sf.EventDispatcher.OnNewSnowflakeEvent(&event.EventOnCurrentNATTypeDetermined{CurNATType: currentNATTypeLoaded})
NatRetestTask := task.Periodic{ Interval: sf.NATTypeMeasurementInterval,
This is an automated email from the git hooks/post-receive script.
itchyonion pushed a commit to branch main in repository pluggable-transports/snowflake.
commit 9d72b30603e644b8cf0645ab8da189814c093650 Author: itchyonion itchyonion@torproject.org AuthorDate: Tue Nov 8 13:22:51 2022 -0800
proxy: Let verbose level act on file logging --- proxy/main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/proxy/main.go b/proxy/main.go index ea8f427..3dad5a9 100644 --- a/proxy/main.go +++ b/proxy/main.go @@ -80,12 +80,12 @@ func main() { AllowNonTLSRelay: *allowNonTLSRelay, }
- var logOutput io.Writer = os.Stderr + var logOutput = ioutil.Discard var eventlogOutput io.Writer = os.Stderr log.SetFlags(log.LstdFlags | log.LUTC)
- if !*verboseLogging { - logOutput = ioutil.Discard + if *verboseLogging { + logOutput = os.Stderr }
if *logFilename != "" { @@ -94,9 +94,12 @@ func main() { log.Fatal(err) } defer f.Close() - logOutput = io.MultiWriter(logOutput, f) + if *verboseLogging { + logOutput = io.MultiWriter(logOutput, f) + } eventlogOutput = io.MultiWriter(eventlogOutput, f) } + if *unsafeLogging { log.SetOutput(logOutput) } else {
tor-commits@lists.torproject.org