Commit 94de69aa authored by Cecylia Bocovich's avatar Cecylia Bocovich 💬
Browse files

Updated broker specification and comments

parent 97554e03
Loading
Loading
Loading
Loading
+2 −57
Original line number Diff line number Diff line
/*
We export metrics in the following format:

    "snowflake-stats-end" YYYY-MM-DD HH:MM:SS (NSEC s) NL
        [At most once.]

        YYYY-MM-DD HH:MM:SS defines the end of the included measurement
        interval of length NSEC seconds (86400 seconds by default).

    "snowflake-ips" CC=NUM,CC=NUM,... NL
        [At most once.]

        List of mappings from two-letter country codes to the number of
        unique IP addresses of snowflake proxies that have polled.

    "snowflake-ips-total" NUM NL
        [At most once.]

        A count of the total number of unique IP addresses of snowflake
        proxies that have polled.

    "snowflake-ips-standalone" NUM NL
        [At most once.]

        A count of the total number of unique IP addresses of snowflake
        proxies of type "standalone" that have polled.

    "snowflake-ips-badge" NUM NL
        [At most once.]

        A count of the total number of unique IP addresses of snowflake
        proxies of type "badge" that have polled.

    "snowflake-ips-webext" NUM NL
        [At most once.]

        A count of the total number of unique IP addresses of snowflake
        proxies of type "webext" that have polled.

    "snowflake-idle-count" NUM NL
        [At most once.]

        A count of the number of times a proxy has polled but received
        no client offer, rounded up to the nearest multiple of 8.

    "client-denied-count" NUM NL
        [At most once.]

        A count of the number of times a client has requested a proxy
        from the broker but no proxies were available, rounded up to
        the nearest multiple of 8.

    "client-snowflake-match-count" NUM NL
        [At most once.]

        A count of the number of times a client successfully received a
        proxy from the broker, rounded up to the nearest multiple of 8.
We export metrics in the format specified in our broker spec:
https://gitweb.torproject.org/pluggable-transports/snowflake.git/tree/doc/broker-spec.txt
*/

package main

import (
	// "golang.org/x/net/internal/timeseries"
	"fmt"
	"log"
	"math"
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ const version = "1.1"
{
  Sid: [generated session id of proxy],
  Version: 1.1,
  Type: [badge|webext|standalone]
  Type: ["badge"|"webext"|"standalone"]
}

== ProxyPollResponse ==
@@ -87,7 +87,7 @@ func EncodePollRequest(sid string, proxyType string) ([]byte, error) {
}

// Decodes a poll message from a snowflake proxy and returns the
// sid of the proxy on success and an error if it failed
// sid and proxy type of the proxy on success and an error if it failed
func DecodePollRequest(data []byte) (string, string, error) {
	var message ProxyPollRequest

+18 −0
Original line number Diff line number Diff line
@@ -31,6 +31,24 @@ Metrics data from the Snowflake broker can be retrieved by sending an HTTP GET r
        A count of the total number of unique IP addresses of Snowflake
        proxies that have polled.

    "snowflake-ips-standalone" NUM NL
        [At most once.]

        A count of the total number of unique IP addresses of snowflake
        proxies of type "standalone" that have polled.

    "snowflake-ips-badge" NUM NL
        [At most once.]

        A count of the total number of unique IP addresses of snowflake
        proxies of type "badge" that have polled.

    "snowflake-ips-webext" NUM NL
        [At most once.]

        A count of the total number of unique IP addresses of snowflake
        proxies of type "webext" that have polled.

    "snowflake-idle-count" NUM NL
        [At most once.]