diff options
author | meskio <meskio@torproject.org> | 2024-05-09 11:42:56 +0200 |
---|---|---|
committer | meskio <meskio@torproject.org> | 2024-05-09 16:24:33 +0200 |
commit | a9df5dd71a305c7342fdfbccb4195b4511e4bc65 (patch) | |
tree | a542ed1e536a6aef8fc4e3e8a1f9bf762a83f613 | |
parent | 7bd3e31d7eb7a426188d9745ff9f437c3efbe81e (diff) | |
download | snowflake-a9df5dd71a305c7342fdfbccb4195b4511e4bc65.tar.gz snowflake-a9df5dd71a305c7342fdfbccb4195b4511e4bc65.zip |
Use ptutil for safelog and prometheus rounded metrics
* Related: #40354
-rw-r--r-- | broker/broker.go | 2 | ||||
-rw-r--r-- | broker/metrics.go | 21 | ||||
-rw-r--r-- | broker/prometheus.go | 83 | ||||
-rw-r--r-- | client/snowflake.go | 2 | ||||
-rw-r--r-- | common/event/interface.go | 2 | ||||
-rw-r--r-- | common/safelog/log.go | 83 | ||||
-rw-r--r-- | common/safelog/log_test.go | 183 | ||||
-rw-r--r-- | go.mod | 11 | ||||
-rw-r--r-- | go.sum | 22 | ||||
-rw-r--r-- | probetest/probetest.go | 2 | ||||
-rw-r--r-- | proxy/main.go | 2 | ||||
-rw-r--r-- | server/server.go | 2 |
12 files changed, 35 insertions, 380 deletions
diff --git a/broker/broker.go b/broker/broker.go index b60faff..aaeab1d 100644 --- a/broker/broker.go +++ b/broker/broker.go @@ -27,8 +27,8 @@ import ( "github.com/aws/aws-sdk-go-v2/service/sqs" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" + "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safelog" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/namematcher" - "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" "golang.org/x/crypto/acme/autocert" ) diff --git a/broker/metrics.go b/broker/metrics.go index a40b1bc..329744f 100644 --- a/broker/metrics.go +++ b/broker/metrics.go @@ -16,6 +16,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "gitlab.torproject.org/tpo/anti-censorship/geoip" + "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safeprom" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/messages" ) @@ -330,14 +331,14 @@ func sumMapValues(m *map[messages.RendezvousMethod]uint) uint { type PromMetrics struct { registry *prometheus.Registry ProxyTotal *prometheus.CounterVec - ProxyPollTotal *RoundedCounterVec - ClientPollTotal *RoundedCounterVec + ProxyPollTotal *safeprom.RoundedCounterVec + ClientPollTotal *safeprom.RoundedCounterVec AvailableProxies *prometheus.GaugeVec - ProxyPollWithRelayURLExtensionTotal *RoundedCounterVec - ProxyPollWithoutRelayURLExtensionTotal *RoundedCounterVec + ProxyPollWithRelayURLExtensionTotal *safeprom.RoundedCounterVec + ProxyPollWithoutRelayURLExtensionTotal *safeprom.RoundedCounterVec - ProxyPollRejectedForRelayURLExtensionTotal *RoundedCounterVec + ProxyPollRejectedForRelayURLExtensionTotal *safeprom.RoundedCounterVec } // Initialize metrics for prometheus exporter @@ -364,7 +365,7 @@ func initPrometheus() *PromMetrics { []string{"type", "nat"}, ) - promMetrics.ProxyPollTotal = NewRoundedCounterVec( + promMetrics.ProxyPollTotal = safeprom.NewRoundedCounterVec( prometheus.CounterOpts{ Namespace: prometheusNamespace, Name: "rounded_proxy_poll_total", @@ -373,7 +374,7 @@ func initPrometheus() *PromMetrics { []string{"nat", "status"}, ) - promMetrics.ProxyPollWithRelayURLExtensionTotal = NewRoundedCounterVec( + promMetrics.ProxyPollWithRelayURLExtensionTotal = safeprom.NewRoundedCounterVec( prometheus.CounterOpts{ Namespace: prometheusNamespace, Name: "rounded_proxy_poll_with_relay_url_extension_total", @@ -382,7 +383,7 @@ func initPrometheus() *PromMetrics { []string{"nat", "type"}, ) - promMetrics.ProxyPollWithoutRelayURLExtensionTotal = NewRoundedCounterVec( + promMetrics.ProxyPollWithoutRelayURLExtensionTotal = safeprom.NewRoundedCounterVec( prometheus.CounterOpts{ Namespace: prometheusNamespace, Name: "rounded_proxy_poll_without_relay_url_extension_total", @@ -391,7 +392,7 @@ func initPrometheus() *PromMetrics { []string{"nat", "type"}, ) - promMetrics.ProxyPollRejectedForRelayURLExtensionTotal = NewRoundedCounterVec( + promMetrics.ProxyPollRejectedForRelayURLExtensionTotal = safeprom.NewRoundedCounterVec( prometheus.CounterOpts{ Namespace: prometheusNamespace, Name: "rounded_proxy_poll_rejected_relay_url_extension_total", @@ -400,7 +401,7 @@ func initPrometheus() *PromMetrics { []string{"nat", "type"}, ) - promMetrics.ClientPollTotal = NewRoundedCounterVec( + promMetrics.ClientPollTotal = safeprom.NewRoundedCounterVec( prometheus.CounterOpts{ Namespace: prometheusNamespace, Name: "rounded_client_poll_total", diff --git a/broker/prometheus.go b/broker/prometheus.go deleted file mode 100644 index d7592ec..0000000 --- a/broker/prometheus.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Implements some additional prometheus metrics that we need for privacy preserving -counts of users and proxies -*/ - -package main - -import ( - "sync/atomic" - - "github.com/prometheus/client_golang/prometheus" - dto "github.com/prometheus/client_model/go" - "google.golang.org/protobuf/proto" -) - -// New Prometheus counter type that produces rounded counts of metrics -// for privacy preserving reasons -type RoundedCounter interface { - prometheus.Metric - - Inc() -} - -type roundedCounter struct { - total uint64 //reflects the true count - value uint64 //reflects the rounded count - - desc *prometheus.Desc - labelPairs []*dto.LabelPair -} - -// Implements the RoundedCounter interface -func (c *roundedCounter) Inc() { - atomic.AddUint64(&c.total, 1) - if c.total > c.value { - atomic.AddUint64(&c.value, 8) - } -} - -// Implements the prometheus.Metric interface -func (c *roundedCounter) Desc() *prometheus.Desc { - return c.desc -} - -// Implements the prometheus.Metric interface -func (c *roundedCounter) Write(m *dto.Metric) error { - m.Label = c.labelPairs - - m.Counter = &dto.Counter{Value: proto.Float64(float64(c.value))} - return nil -} - -// New prometheus vector type that will track RoundedCounter metrics -// accross multiple labels -type RoundedCounterVec struct { - *prometheus.MetricVec -} - -func NewRoundedCounterVec(opts prometheus.CounterOpts, labelNames []string) *RoundedCounterVec { - desc := prometheus.NewDesc( - prometheus.BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - labelNames, - opts.ConstLabels, - ) - return &RoundedCounterVec{ - MetricVec: prometheus.NewMetricVec(desc, func(lvs ...string) prometheus.Metric { - if len(lvs) != len(labelNames) { - panic("inconsistent cardinality") - } - return &roundedCounter{desc: desc, labelPairs: prometheus.MakeLabelPairs(desc, lvs)} - }), - } -} - -// Helper function to return the underlying RoundedCounter metric from MetricVec -func (v *RoundedCounterVec) With(labels prometheus.Labels) RoundedCounter { - metric, err := v.GetMetricWith(labels) - if err != nil { - panic(err) - } - return metric.(RoundedCounter) -} diff --git a/client/snowflake.go b/client/snowflake.go index 4ebbaf5..a98f3d3 100644 --- a/client/snowflake.go +++ b/client/snowflake.go @@ -17,10 +17,10 @@ import ( pt "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib" + "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safelog" sf "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/client/lib" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/proxy" - "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/version" ) diff --git a/common/event/interface.go b/common/event/interface.go index eb73dfa..c3abd97 100644 --- a/common/event/interface.go +++ b/common/event/interface.go @@ -5,7 +5,7 @@ import ( "time" "github.com/pion/webrtc/v3" - "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" + "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safelog" ) type SnowflakeEvent interface { diff --git a/common/safelog/log.go b/common/safelog/log.go deleted file mode 100644 index bece6bf..0000000 --- a/common/safelog/log.go +++ /dev/null @@ -1,83 +0,0 @@ -//Package for a safer logging wrapper around the standard logging package - -// import "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" -package safelog - -import ( - "bytes" - "io" - "regexp" - "sync" -) - -const ipv4Address = `\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}` - -// %3A and %3a are for matching : in URL-encoded IPv6 addresses -const colon = `(:|%3a|%3A)` -const ipv6Address = `([0-9a-fA-F]{0,4}` + colon + `){5,7}([0-9a-fA-F]{0,4})?` -const ipv6Compressed = `([0-9a-fA-F]{0,4}` + colon + `){0,5}([0-9a-fA-F]{0,4})?(` + colon + `){2}([0-9a-fA-F]{0,4}` + colon + `){0,5}([0-9a-fA-F]{0,4})?` -const ipv6Full = `(` + ipv6Address + `(` + ipv4Address + `))` + - `|(` + ipv6Compressed + `(` + ipv4Address + `))` + - `|(` + ipv6Address + `)` + `|(` + ipv6Compressed + `)` -const optionalPort = `(:\d{1,5})?` -const addressPattern = `((` + ipv4Address + `)|(\[(` + ipv6Full + `)\])|(` + ipv6Full + `))` + optionalPort -const fullAddrPattern = `(?:^|\s|[^\w:])(` + addressPattern + `)(?:\s|(:\s)|[^\w:]|$)` - -var scrubberPatterns = []*regexp.Regexp{ - regexp.MustCompile(fullAddrPattern), -} - -var addressRegexp = regexp.MustCompile(addressPattern) - -// An io.Writer that can be used as the output for a logger that first -// sanitizes logs and then writes to the provided io.Writer -type LogScrubber struct { - Output io.Writer - buffer []byte - - lock sync.Mutex -} - -func (ls *LogScrubber) Lock() { (*ls).lock.Lock() } -func (ls *LogScrubber) Unlock() { (*ls).lock.Unlock() } - -func Scrub(b []byte) []byte { - scrubbedBytes := b - for _, pattern := range scrubberPatterns { - // this is a workaround since go does not yet support look ahead or look - // behind for regular expressions. - var newBytes []byte - index := 0 - for { - loc := pattern.FindSubmatchIndex(scrubbedBytes[index:]) - if loc == nil { - break - } - newBytes = append(newBytes, scrubbedBytes[index:index+loc[2]]...) - newBytes = append(newBytes, []byte("[scrubbed]")...) - index = index + loc[3] - } - scrubbedBytes = append(newBytes, scrubbedBytes[index:]...) - } - return scrubbedBytes -} - -func (ls *LogScrubber) Write(b []byte) (n int, err error) { - ls.Lock() - defer ls.Unlock() - - n = len(b) - ls.buffer = append(ls.buffer, b...) - for { - i := bytes.LastIndexByte(ls.buffer, '\n') - if i == -1 { - return - } - fullLines := ls.buffer[:i+1] - _, err = ls.Output.Write(Scrub(fullLines)) - if err != nil { - return - } - ls.buffer = ls.buffer[i+1:] - } -} diff --git a/common/safelog/log_test.go b/common/safelog/log_test.go deleted file mode 100644 index 267538c..0000000 --- a/common/safelog/log_test.go +++ /dev/null @@ -1,183 +0,0 @@ -package safelog - -import ( - "bytes" - "log" - "testing" -) - -// Check to make sure that addresses split across calls to write are still scrubbed -func TestLogScrubberSplit(t *testing.T) { - input := []byte("test\nhttp2: panic serving [2620:101:f000:780:9097:75b1:519f:dbb8]:58344: interface conversion: *http2.responseWriter is not http.Hijacker: missing method Hijack\n") - - expected := "test\nhttp2: panic serving [scrubbed]: interface conversion: *http2.responseWriter is not http.Hijacker: missing method Hijack\n" - - var buff bytes.Buffer - scrubber := &LogScrubber{Output: &buff} - n, err := scrubber.Write(input[:12]) //test\nhttp2: - if n != 12 { - t.Errorf("wrong number of bytes %d", n) - } - if err != nil { - t.Errorf("%q", err) - } - if buff.String() != "test\n" { - t.Errorf("Got %q, expected %q", buff.String(), "test\n") - } - - n, err = scrubber.Write(input[12:30]) //panic serving [2620:101:f - if n != 18 { - t.Errorf("wrong number of bytes %d", n) - } - if err != nil { - t.Errorf("%q", err) - } - if buff.String() != "test\n" { - t.Errorf("Got %q, expected %q", buff.String(), "test\n") - } - - n, err = scrubber.Write(input[30:]) //000:780:9097:75b1:519f:dbb8]:58344: interface conversion: *http2.responseWriter is not http.Hijacker: missing method Hijack\n - if n != (len(input) - 30) { - t.Errorf("wrong number of bytes %d", n) - } - if err != nil { - t.Errorf("%q", err) - } - if buff.String() != expected { - t.Errorf("Got %q, expected %q", buff.String(), expected) - } - -} - -// Test the log scrubber on known problematic log messages -func TestLogScrubberMessages(t *testing.T) { - for _, test := range []struct { - input, expected string - }{ - { - "http: TLS handshake error from 129.97.208.23:38310: ", - "http: TLS handshake error from [scrubbed]: \n", - }, - { - "http2: panic serving [2620:101:f000:780:9097:75b1:519f:dbb8]:58344: interface conversion: *http2.responseWriter is not http.Hijacker: missing method Hijack", - "http2: panic serving [scrubbed]: interface conversion: *http2.responseWriter is not http.Hijacker: missing method Hijack\n", - }, - { - //Make sure it doesn't scrub fingerprint - "a=fingerprint:sha-256 33:B6:FA:F6:94:CA:74:61:45:4A:D2:1F:2C:2F:75:8A:D9:EB:23:34:B2:30:E9:1B:2A:A6:A9:E0:44:72:CC:74", - "a=fingerprint:sha-256 33:B6:FA:F6:94:CA:74:61:45:4A:D2:1F:2C:2F:75:8A:D9:EB:23:34:B2:30:E9:1B:2A:A6:A9:E0:44:72:CC:74\n", - }, - { - //try with enclosing parens - "(1:2:3:4:c:d:e:f) {1:2:3:4:c:d:e:f}", - "([scrubbed]) {[scrubbed]}\n", - }, - { - //Make sure it doesn't scrub timestamps - "2019/05/08 15:37:31 starting", - "2019/05/08 15:37:31 starting\n", - }, - { - //Make sure ipv6 addresses where : are encoded as %3A or %3a are scrubbed - "error dialing relay: wss://snowflake.torproject.net/?client_ip=6201%3ac8%3A3004%3A%3A1234", - "error dialing relay: wss://snowflake.torproject.net/?client_ip=[scrubbed]\n", - }, - { - // make sure url encoded IPv6 IPs get scrubbed (%3a) - "http2: panic serving [fd00%3a111%3af000%3a777%3a9999%3abbbb%3affff%3adddd]:58344: xxx", - "http2: panic serving [scrubbed]: xxx\n", - }, - { - // make sure url encoded IPv6 IPs get scrubbed (%3A) - "http2: panic serving [fd00%3a111%3af000%3a777%3a9999%3abbbb%3affff%3adddd]:58344: xxx", - "http2: panic serving [scrubbed]: xxx\n", - }, - { - // make sure url encoded IPv6 IPs get scrubbed, different URL (%3A) - "error dialing relay: wss://snowflake.torproject.net/?client_ip=fd00%3A8888%3Abbbb%3Acccc%3Adddd%3Aeeee%3A2222%3A123 = dial tcp xxx", - "error dialing relay: wss://snowflake.torproject.net/?client_ip=[scrubbed] = dial tcp xxx\n", - }, - { - // make sure url encoded IPv6 IPs get scrubbed (%3A), compressed - "http2: panic serving [1%3A2%3A3%3A%3Ad%3Ae%3Af]:55: xxx", - "http2: panic serving [scrubbed]: xxx\n", - }, - { - // make sure url encoded IPv6 IPs get scrubbed (%3A), compressed - "error dialing relay: wss://snowflake.torproject.net/?client_ip=1%3A2%3A3%3A%3Ad%3Ae%3Af = dial tcp xxx", - "error dialing relay: wss://snowflake.torproject.net/?client_ip=[scrubbed] = dial tcp xxx\n", - }, - { - // multiple space-separated IP addresses - "Allowed stations: [10.0.1.1 10.0.1.2 10.0.1.3 10.0.1.4]\n", - "Allowed stations: [[scrubbed] [scrubbed] [scrubbed] [scrubbed]]\n", - }, - } { - var buff bytes.Buffer - log.SetFlags(0) //remove all extra log output for test comparisons - log.SetOutput(&LogScrubber{Output: &buff}) - log.Print(test.input) - if buff.String() != test.expected { - t.Errorf("%q: got %q, expected %q", test.input, buff.String(), test.expected) - } - } - -} - -func TestLogScrubberGoodFormats(t *testing.T) { - for _, addr := range []string{ - // IPv4 - "1.2.3.4", - "255.255.255.255", - // IPv4 with port - "1.2.3.4:55", - "255.255.255.255:65535", - // IPv6 - "1:2:3:4:c:d:e:f", - "1111:2222:3333:4444:CCCC:DDDD:EEEE:FFFF", - // IPv6 with brackets - "[1:2:3:4:c:d:e:f]", - "[1111:2222:3333:4444:CCCC:DDDD:EEEE:FFFF]", - // IPv6 with brackets and port - "[1:2:3:4:c:d:e:f]:55", - "[1111:2222:3333:4444:CCCC:DDDD:EEEE:FFFF]:65535", - // compressed IPv6 - "::f", - "::d:e:f", - "1:2:3::", - "1:2:3::d:e:f", - "1:2:3:d:e:f::", - "::1:2:3:d:e:f", - "1111:2222:3333::DDDD:EEEE:FFFF", - // compressed IPv6 with brackets - "[::d:e:f]", - "[1:2:3::]", - "[1:2:3::d:e:f]", - "[1111:2222:3333::DDDD:EEEE:FFFF]", - "[1:2:3:4:5:6::8]", - "[1::7:8]", - // compressed IPv6 with brackets and port - "[1::]:58344", - "[::d:e:f]:55", - "[1:2:3::]:55", - "[1:2:3::d:e:f]:55", - "[1111:2222:3333::DDDD:EEEE:FFFF]:65535", - // IPv4-compatible and IPv4-mapped - "::255.255.255.255", - "::ffff:255.255.255.255", - "[::255.255.255.255]", - "[::ffff:255.255.255.255]", - "[::255.255.255.255]:65535", - "[::ffff:255.255.255.255]:65535", - "[::ffff:0:255.255.255.255]", - "[2001:db8:3:4::192.0.2.33]", - } { - var buff bytes.Buffer - log.SetFlags(0) //remove all extra log output for test comparisons - log.SetOutput(&LogScrubber{Output: &buff}) - log.Print(addr) - if buff.String() != "[scrubbed]\n" { - t.Errorf("%q: Got %q, expected %q", addr, buff.String(), "[scrubbed]\n") - } - } -} @@ -16,7 +16,6 @@ require ( github.com/pion/transport/v2 v2.2.4 github.com/pion/webrtc/v3 v3.2.40 github.com/prometheus/client_golang v1.19.0 - github.com/prometheus/client_model v0.6.1 github.com/realclientip/realclientip-go v1.0.0 github.com/refraction-networking/utls v1.6.6 github.com/smartystreets/goconvey v1.8.1 @@ -26,10 +25,10 @@ require ( github.com/xtaci/smux v1.5.24 gitlab.torproject.org/tpo/anti-censorship/geoip v0.0.0-20210928150955-7ce4b3d98d01 gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib v1.5.0 + gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil v0.0.0-20240509090240-b27cf78add95 golang.org/x/crypto v0.23.0 golang.org/x/net v0.25.0 golang.org/x/sys v0.20.0 - google.golang.org/protobuf v1.34.0 ) require ( @@ -45,7 +44,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect github.com/aws/smithy-go v1.20.2 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/uuid v1.3.1 // indirect @@ -69,8 +68,9 @@ require ( github.com/pion/turn/v2 v2.1.4 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.53.0 // indirect + github.com/prometheus/procfs v0.14.0 // indirect github.com/smarty/assertions v1.15.0 // indirect github.com/templexxx/cpu v0.1.0 // indirect github.com/templexxx/xorsimd v0.4.2 // indirect @@ -79,5 +79,6 @@ require ( golang.org/x/mod v0.16.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.19.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -33,8 +33,8 @@ github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= @@ -146,10 +146,10 @@ github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdU github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= -github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE= +github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U= +github.com/prometheus/procfs v0.14.0 h1:Lw4VdGGoKEZilJsayHf0B+9YgLGREba2C6xr+Fdfq6s= +github.com/prometheus/procfs v0.14.0/go.mod h1:XL+Iwz8k8ZabyZfMFHPiilCniixqQarAy5Mu67pHlNQ= github.com/realclientip/realclientip-go v1.0.0 h1:+yPxeC0mEaJzq1BfCt2h4BxlyrvIIBzR6suDc3BEF1U= github.com/realclientip/realclientip-go v1.0.0/go.mod h1:CXnUdVwFRcXFJIRb/dTYqbT7ud48+Pi2pFm80bxDmcI= github.com/refraction-networking/utls v1.6.6 h1:igFsYBUJPYM8Rno9xUuDoM5GQrVEqY4llzEXOkL43Ig= @@ -195,6 +195,8 @@ gitlab.torproject.org/tpo/anti-censorship/geoip v0.0.0-20210928150955-7ce4b3d98d gitlab.torproject.org/tpo/anti-censorship/geoip v0.0.0-20210928150955-7ce4b3d98d01/go.mod h1:K3LOI4H8fa6j+7E10ViHeGEQV10304FG4j94ypmKLjY= gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib v1.5.0 h1:rzdY78Ox2T+VlXcxGxELF+6VyUXlZBhmRqZu5etLm+c= gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib v1.5.0/go.mod h1:70bhd4JKW/+1HLfm+TMrgHJsUHG4coelMWwiVEJ2gAg= +gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil v0.0.0-20240509090240-b27cf78add95 h1:kJmLAISlzRcFr4+HyKcAOTelVQH+lI/Z5nqqzYmLSO8= +gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil v0.0.0-20240509090240-b27cf78add95/go.mod h1:ASIO5DzEHaAry1aSQDdhwoUy97E44kXqxya/LehoPKY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -243,8 +245,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -318,8 +320,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= -google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/probetest/probetest.go b/probetest/probetest.go index 55152c9..944fb9b 100644 --- a/probetest/probetest.go +++ b/probetest/probetest.go @@ -19,8 +19,8 @@ import ( "strings" "time" + "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safelog" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/messages" - "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/util" "github.com/pion/transport/v2/stdnet" diff --git a/proxy/main.go b/proxy/main.go index 5df1893..cec6e3e 100644 --- a/proxy/main.go +++ b/proxy/main.go @@ -11,8 +11,8 @@ import ( "strings" "time" + "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safelog" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event" - "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/version" sf "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/proxy/lib" ) diff --git a/server/server.go b/server/server.go index ae4120a..0a92e69 100644 --- a/server/server.go +++ b/server/server.go @@ -18,7 +18,7 @@ import ( "sync" "syscall" - "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" + "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safelog" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/version" "golang.org/x/crypto/acme/autocert" |