[tor-commits] [meek/master] Regen man pages.

2017-04-22 Thread dcf
commit 451320610020753ccaee2d533972a6ae5a1873c0
Author: David Fifield 
Date:   Sat Apr 22 23:30:37 2017 -0700

Regen man pages.
---
 doc/meek-server.1 | 82 +++
 1 file changed, 71 insertions(+), 11 deletions(-)

diff --git a/doc/meek-server.1 b/doc/meek-server.1
index 5dab7dd..09d198c 100644
--- a/doc/meek-server.1
+++ b/doc/meek-server.1
@@ -1,13 +1,13 @@
 '\" t
 .\" Title: meek-server
 .\"Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 
-.\"  Date: 08/10/2014
+.\" Generator: DocBook XSL Stylesheets v1.79.1 
+.\"  Date: 04/22/2017
 .\"Manual: \ \&
 .\"Source: \ \&
 .\"  Language: English
 .\"
-.TH "MEEK\-SERVER" "1" "08/10/2014" "\ \&" "\ \&"
+.TH "MEEK\-SERVER" "1" "04/22/2017" "\ \&" "\ \&"
 .\" -
 .\" * Define some portability stuff
 .\" -
@@ -31,40 +31,96 @@
 meek-server \- The meek server transport plugin
 .SH "SYNOPSIS"
 .sp
-\fBmeek\-server\fR \fB\-\-cert\fR=\fIFILENAME\fR \fB\-\-key\fR=\fIFILENAME\fR 
[\fIOPTIONS\fR]
+\fBmeek\-server\fR \fB\-\-acme\-hostnames\fR=\fIHOSTNAME\fR [\fIOPTIONS\fR]
 .SH "DESCRIPTION"
 .sp
 meek\-server is a transport plugin for Tor that encodes a stream as a sequence 
of HTTP requests and responses\&.
 .sp
-The server runs in HTTPS mode by default, and the \fB\-\-cert\fR and 
\fB\-\-key\fR options are required\&. Use the \fB\-\-disable\-tls\fR option to 
run with plain HTTP\&.
+You will need to configure TLS certificates\&. There are two ways to set up 
certificates:
 .sp
-Configuration for meek\-server usually appears in a torrc file\&. Here is a 
sample configuration using HTTPS:
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fB\-\-acme\-hostnames\fR=\fIHOSTNAME\fR
+(with optional
+\fB\-\-acme\-email\fR=\fIEMAIL\fR) will automatically get certificates for
+\fIHOSTNAME\fR
+using Let\(cqs Encrypt\&. This only works when meek\-server is running on port 
443\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fB\-\-cert\fR=\fIFILENAME\fR
+and
+\fB\-\-key\fR=\fIFILENAME\fR
+allow use to use your own externally acquired certificate\&.
+.RE
+.sp
+Configuration for meek\-server usually appears in a torrc file\&. Here is a 
sample configuration using automatic Let\(cqs Encrypt certificates:
 .sp
 .if n \{\
 .RS 4
 .\}
 .nf
 ExtORPort auto
-ServerTransportPlugin meek exec \&./meek\-server \-\-port 8443 \-\-cert 
cert\&.pem \-\-key key\&.pem \-\-log meek\-server\&.log
+ServerTransportListenAddr 0\&.0\&.0\&.0:443
+ServerTransportPlugin meek exec \&./meek\-server \-\-acme\-hostnames 
meek\-server\&.example \-\-log meek\-server\&.log
 .fi
 .if n \{\
 .RE
 .\}
 .sp
-Here is a sample configuration using plain HTTP:
+Here is a sample configuration using externally acquired certificates:
 .sp
 .if n \{\
 .RS 4
 .\}
 .nf
 ExtORPort auto
-ServerTransportPlugin meek exec \&./meek\-server \-\-port 8080 
\-\-disable\-tls \-\-log meek\-server\&.log
+ServerTransportListenAddr meek 0\&.0\&.0\&.0:8443
+ServerTransportPlugin meek exec \&./meek\-server 8443 \-\-cert cert\&.pem 
\-\-key key\&.pem \-\-log meek\-server\&.log
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+To listen on port 443 without needed to run as root, on Linux, you can use the 
setcap program, part of libcap2:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+setcap \*(Aqcap_net_bind_service=+ep\*(Aq /usr/local/bin/meek\-server
 .fi
 .if n \{\
 .RE
 .\}
 .SH "OPTIONS"
 .PP
+\fB\-\-acme\-email\fR=\fIEMAIL\fR
+.RS 4
+Optional email address to register for Let\(cqs Encrypt notifications when 
using
+\fB\-\-acme\-hostnames\fR\&.
+.RE
+.PP
+\fB\-\-acme\-hostnames\fR=\fIHOSTNAME\fR[,\fIHOSTNAME\fR]\&...
+.RS 4
+Comma\-separated list of hostnames to honor when getting automatic 
certificates from Let\(cqs Encrypt\&. meek\-server has to be running on port 
443 in order for the
+\fB\-\-acme\-hostnames\fR
+option to work\&. The certificates will be cached in the 
pt_state/meek\-certificate\-cache directory inside tor state directory\&.
+.RE
+.PP
 \fB\-\-cert\fR=\fIFILENAME\fR
 .RS 4
 Name of a PEM\-encoded TLS certificate file\&. Required unless
@@ -72,7 +128,7 @@ Name of a PEM\-encoded TLS certificate file\&. Required 
unless
 is used\&.
 .RE
 .sp
-\fB\-\-disable\-tls\fR: Use plain HTTP rather than HTTPS\&.
+\fB\-\-disable\-tls\fR: Use plain HTTP rather than HTTPS\&. This option is 
only for testing purposes\&. Don\(cqt use it in production\&.
 .sp
 \fB\-\-key\fR=\fIFILENAME\fR: Name of a PEM\-encoded TLS private key file\&. 
Required unless \fB\-\-disable\-tls\fR is used\&.
 .PP
@@ -83,7 +139,11 @@ Name of a file to write log messages to (default stderr)\&.
 .PP
 \fB\-\-port\fR=\fIPORT\fR
 .RS 4
-Port to listen on\&. Overrides the TOR_PT_SERVER_BINDADDR environment variable 

[tor-commits] [meek/master] Wait briefly after calling ListenAndServe{TLS} to see if it errors.

2017-04-22 Thread dcf
commit e3f3054f8b74caa639a6d9be09702693af9a70e7
Author: David Fifield 
Date:   Thu Apr 20 00:39:30 2017 -0700

Wait briefly after calling ListenAndServe{TLS} to see if it errors.

An unfortunate effect of using net/http ListenAndServe and
ListenAndServeTLS is that you don't get early errors like "permission
denied" and "address already in use"--they happen later which means they
appear only in the meek-server log, not in the tor log. Here we apply a
hack to hold on for a fraction of a second to see if the call errors,
hopefully long enough to catch most of such errors.
---
 meek-server/meek-server.go | 29 -
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/meek-server/meek-server.go b/meek-server/meek-server.go
index dcb0c5c..d1000ea 100644
--- a/meek-server/meek-server.go
+++ b/meek-server/meek-server.go
@@ -61,6 +61,9 @@ const (
// Cull unused session ids (with their corresponding OR port connection)
// if we haven't seen any activity for this long.
maxSessionStaleness = 120 * time.Second
+   // How long to wait for ListenAndServe or ListenAndServeTLS to return an
+   // error before deciding that it's not going to return.
+   listenAndServeErrorTimeout = 100 * time.Millisecond
 )
 
 var ptInfo pt.ServerInfo
@@ -276,7 +279,7 @@ func (state *State) ExpireSessions() {
 
 func initServer(addr *net.TCPAddr,
getCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error),
-   listenAndServe func(*http.Server)) (*http.Server, error) {
+   listenAndServe func(*http.Server, chan<- error)) (*http.Server, error) {
// We're not capable of listening on port 0 (i.e., an ephemeral port
// unknown in advance). The reason is that while the net/http package
// exposes ListenAndServe and ListenAndServeTLS, those functions never
@@ -310,28 +313,44 @@ func initServer(addr *net.TCPAddr,
}
server.TLSConfig.GetCertificate = getCertificate
 
-   go listenAndServe(server)
+   // Another unfortunate effect of the inseparable net/http ListenAndServe
+   // is that we can't check for Listen errors like "permission denied" and
+   // "address already in use" without potentially entering the infinite
+   // loop of Serve. The hack we apply here is to wait a short time,
+   // listenAndServeErrorTimeout, to see if an error is returned (because
+   // it's better if the error message goes to the tor log through
+   // SMETHOD-ERROR than if it only goes to the meek-server log).
+   errChan := make(chan error)
+   go listenAndServe(server, errChan)
+   select {
+   case err = <-errChan:
+   break
+   case <-time.After(listenAndServeErrorTimeout):
+   break
+   }
 
-   return server, nil
+   return server, err
 }
 
 func startServer(addr *net.TCPAddr) (*http.Server, error) {
-   return initServer(addr, nil, func(server *http.Server) {
+   return initServer(addr, nil, func(server *http.Server, errChan chan<- 
error) {
log.Printf("listening with plain HTTP on %s", addr)
err := server.ListenAndServe()
if err != nil {
log.Printf("Error in ListenAndServe: %s", err)
}
+   errChan <- err
})
 }
 
 func startServerTLS(addr *net.TCPAddr, getCertificate 
func(*tls.ClientHelloInfo) (*tls.Certificate, error)) (*http.Server, error) {
-   return initServer(addr, getCertificate, func(server *http.Server) {
+   return initServer(addr, getCertificate, func(server *http.Server, 
errChan chan<- error) {
log.Printf("listening with HTTPS on %s", addr)
err := server.ListenAndServeTLS("", "")
if err != nil {
log.Printf("Error in ListenAndServeTLS: %s", err)
}
+   errChan <- err
})
 }
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [meek/master] Update programVersion = "0.27".

2017-04-22 Thread dcf
commit 5bdd128a39c6eab2850e64c8ab75112f659d916c
Author: David Fifield 
Date:   Thu Apr 20 01:29:29 2017 -0700

Update programVersion = "0.27".
---
 meek-server/meek-server.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meek-server/meek-server.go b/meek-server/meek-server.go
index d1000ea..908fb8b 100644
--- a/meek-server/meek-server.go
+++ b/meek-server/meek-server.go
@@ -42,7 +42,7 @@ import (
 )
 
 const (
-   programVersion = "0.26"
+   programVersion = "0.27"
 
ptMethodName = "meek"
// Reject session ids shorter than this, as a weak defense against

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [meek/master] Use ListenAndServe{TLS} rather than separate Listen and Serve.

2017-04-22 Thread dcf
commit cea86c937dc278ba6b2100c238b1d5206bbae2f0
Author: David Fifield 
Date:   Tue Apr 11 22:18:47 2017 -0700

Use ListenAndServe{TLS} rather than separate Listen and Serve.

The net/http package provides ListenAndServe and ListenAndServeTLS
functions, but it doesn't provide a way to set up a listener without
also entering an infinite serve loop. This matters for
ListenAndServeTLS, which sets up a lot of magic behind the scenes for
TLS and HTTP/2 support. Formerly, we had copy-pasted code from
ListenAndServeTLS, but that code has only gotten more complicated in
upstream net/http.

The price we pay for this is that it's no longer possible for a server
bindaddr to ask to listen on port 0 (i.e., a random ephemeral port).
That's because we never get a change to find out what the listening
address is, before entering the serve loop.

What we gain is HTTP/2 support; formerly our copy-pasted code had the
side effect of disabling HTTP/2, because it was copied from an older
version and did things like
config.NextProtos = []string{"http/1.1"}

The new code calls http2.ConfigureServer first, but that's not what's
providing HTTP/2 support. HTTP/2 support happens by default. The reason
we call http2.ConfigureServer is because we need to set
TLSConfig.GetCertificate, and http2.ConfigureServer is a convenient way
to initialize TLSConfig in a way that is guaranteed to work with HTTP/2.
---
 meek-server/meek-server.go | 116 +++--
 1 file changed, 60 insertions(+), 56 deletions(-)

diff --git a/meek-server/meek-server.go b/meek-server/meek-server.go
index 2b49897..dcb0c5c 100644
--- a/meek-server/meek-server.go
+++ b/meek-server/meek-server.go
@@ -38,6 +38,7 @@ import (
 
"git.torproject.org/pluggable-transports/goptlib.git"
"golang.org/x/crypto/acme/autocert"
+   "golang.org/x/net/http2"
 )
 
 const (
@@ -273,65 +274,65 @@ func (state *State) ExpireSessions() {
}
 }
 
-func listenTLS(network string, addr *net.TCPAddr, getCertificate 
func(*tls.ClientHelloInfo) (*tls.Certificate, error)) (net.Listener, error) {
-   // This is cribbed from the source of net/http.Server.ListenAndServeTLS.
-   // We have to separate the Listen and Serve parts because we need to
-   // report the listening address before entering Serve (which is an
-   // infinite loop).
+func initServer(addr *net.TCPAddr,
+   getCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error),
+   listenAndServe func(*http.Server)) (*http.Server, error) {
+   // We're not capable of listening on port 0 (i.e., an ephemeral port
+   // unknown in advance). The reason is that while the net/http package
+   // exposes ListenAndServe and ListenAndServeTLS, those functions never
+   // return, so there's no opportunity to find out what the port number
+   // is, in between the Listen and Serve steps.
// https://groups.google.com/d/msg/Golang-nuts/3F1VRCCENp8/3hcayZiwYM8J
-   config := &tls.Config{}
-   config.NextProtos = []string{"http/1.1"}
-   config.GetCertificate = getCertificate
-
-   conn, err := net.ListenTCP(network, addr)
-   if err != nil {
-   return nil, err
-   }
-
-   // Additionally disable SSLv3 because of the POODLE attack.
-   // 
http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
-   // 
https://code.google.com/p/go/source/detail?r=ad9e191a51946e43f1abac8b6a2fefbf2291eea7
-   config.MinVersion = tls.VersionTLS10
-
-   tlsListener := tls.NewListener(conn, config)
-
-   return tlsListener, nil
-}
-
-func startListener(network string, addr *net.TCPAddr) (net.Listener, error) {
-   ln, err := net.ListenTCP(network, addr)
-   if err != nil {
-   return nil, err
+   if addr.Port == 0 {
+   return nil, fmt.Errorf("cannot listen on port %d; configure a 
port using ServerTransportListenAddr", addr.Port)
}
-   log.Printf("listening with plain HTTP on %s", ln.Addr())
-   return startServer(ln)
-}
-
-func startListenerTLS(network string, addr *net.TCPAddr, getCertificate 
func(*tls.ClientHelloInfo) (*tls.Certificate, error)) (net.Listener, error) {
-   ln, err := listenTLS(network, addr, getCertificate)
-   if err != nil {
-   return nil, err
-   }
-   log.Printf("listening with HTTPS on %s", ln.Addr())
-   return startServer(ln)
-}
 
-func startServer(ln net.Listener) (net.Listener, error) {
state := NewState()
go state.ExpireSessions()
+
server := &http.Server{
+   Addr: addr.String(),
Handler:  state,
ReadTimeout:  readWriteTimeout,
WriteTimeout: readWriteTimeout,
}
-   go func() {
-   defer ln.Close()
-   err := server.Serve(

[tor-commits] [doctor/master] Drop notification about BW authority outages to notice runlevel

2017-04-22 Thread atagar
commit 134e6be6a2da4f6be04b531ad67f978e419b9efb
Author: Damian Johnson 
Date:   Sat Apr 22 11:32:13 2017 -0700

Drop notification about BW authority outages to notice runlevel

Dropping the runlevel so it provides daily notifications rather than every 
four
hours. This is because maatuska's is down and there's no ETA for it.
---
 consensus_health_checker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index e67f798..b88f534 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -553,7 +553,7 @@ def voting_bandwidth_scanners(latest_consensus, 
consensuses, votes):
   issues = []
 
   if missing_authorities:
-runlevel = Runlevel.ERROR if len(missing_authorities) > 1 else 
Runlevel.WARNING
+runlevel = Runlevel.ERROR if len(missing_authorities) > 1 else 
Runlevel.NOTICE
 issues.append(Issue(runlevel, 'MISSING_BANDWIDTH_SCANNERS', authorities = 
', '.join(missing_authorities), to = missing_authorities))
 
   if extra_authorities:

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/liveusb-creator] Update translations for liveusb-creator

2017-04-22 Thread translation
commit 4e812da7b1a8021a502ec6898a6d4a26f8344ab9
Author: Translation commit bot 
Date:   Sat Apr 22 15:45:33 2017 +

Update translations for liveusb-creator
---
 nb/nb.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nb/nb.po b/nb/nb.po
index fbcbcc3..13d5595 100644
--- a/nb/nb.po
+++ b/nb/nb.po
@@ -13,7 +13,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2015-11-02 21:23+0100\n"
-"PO-Revision-Date: 2017-03-30 06:56+\n"
+"PO-Revision-Date: 2017-04-22 15:44+\n"
 "Last-Translator: Allan Nordhøy \n"
 "Language-Team: Norwegian Bokmål 
(http://www.transifex.com/otf/torproject/language/nb/)\n"
 "MIME-Version: 1.0\n"

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/https_everywhere_completed] Update translations for https_everywhere_completed

2017-04-22 Thread translation
commit cadcbc1a7badd43017c10ca50b9e29719ccba956
Author: Translation commit bot 
Date:   Sat Apr 22 15:45:29 2017 +

Update translations for https_everywhere_completed
---
 nb/https-everywhere.dtd | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nb/https-everywhere.dtd b/nb/https-everywhere.dtd
index 1c4846b..c7a7f20 100644
--- a/nb/https-everywhere.dtd
+++ b/nb/https-everywhere.dtd
@@ -9,11 +9,11 @@
 
 
 
-
-
+
+
 
-
-
+
+
 
 
 

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/https_everywhere] Update translations for https_everywhere

2017-04-22 Thread translation
commit b371431daeb6a7a543a58445392b22957f35f323
Author: Translation commit bot 
Date:   Sat Apr 22 15:45:24 2017 +

Update translations for https_everywhere
---
 nb/https-everywhere.dtd | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nb/https-everywhere.dtd b/nb/https-everywhere.dtd
index 1c4846b..c7a7f20 100644
--- a/nb/https-everywhere.dtd
+++ b/nb/https-everywhere.dtd
@@ -9,11 +9,11 @@
 
 
 
-
-
+
+
 
-
-
+
+
 
 
 

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/liveusb-creator_completed] Update translations for liveusb-creator_completed

2017-04-22 Thread translation
commit 2383ed2fbd8999d2561c34c3356d7cf166cc4205
Author: Translation commit bot 
Date:   Sat Apr 22 15:45:37 2017 +

Update translations for liveusb-creator_completed
---
 nb/nb.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nb/nb.po b/nb/nb.po
index fbcbcc3..13d5595 100644
--- a/nb/nb.po
+++ b/nb/nb.po
@@ -13,7 +13,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2015-11-02 21:23+0100\n"
-"PO-Revision-Date: 2017-03-30 06:56+\n"
+"PO-Revision-Date: 2017-04-22 15:44+\n"
 "Last-Translator: Allan Nordhøy \n"
 "Language-Team: Norwegian Bokmål 
(http://www.transifex.com/otf/torproject/language/nb/)\n"
 "MIME-Version: 1.0\n"

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [atlas/master] Switch to using KiB/MiB instead of kB/MB to match tor

2017-04-22 Thread irl
commit a2b3f23f0212a16ae410d513749b535fdbe6bc5a
Author: Iain R. Learmonth 
Date:   Sat Apr 22 16:21:53 2017 +0100

Switch to using KiB/MiB instead of kB/MB to match tor

The Tor client uses 1024 bytes per "KBytes" in the torrc, but Atlas was 
using
1000. This also replaces units with the binary prefixed version.

Closes: #21822
---
 js/helpers.js| 8 
 templates/search/do.html | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/js/helpers.js b/js/helpers.js
index 0d50709..583a302 100644
--- a/js/helpers.js
+++ b/js/helpers.js
@@ -249,13 +249,13 @@ var CountryCodes = {
 }
 
 function hrBandwidth(bw) {
-var bw_k = bw/1000;
-var bw_m = bw_k/1000;
+var bw_k = bw/1024;
+var bw_m = bw_k/1024;
 
 if (bw_m >= 1) {
-return Math.round(bw_m * 100) / 100 + " MB/s";
+return Math.round(bw_m * 100) / 100 + " MiB/s";
 } else if (bw_k >= 1) {
-return Math.round(bw_k * 100) / 100 + " KB/s";
+return Math.round(bw_k * 100) / 100 + " KiB/s";
 }
 
 return bw + " B/s";
diff --git a/templates/search/do.html b/templates/search/do.html
index 51a2d82..7122ede 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -131,7 +131,7 @@
 
 

-   
+   




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [atlas/master] Support bandwidth values that are zero

2017-04-22 Thread irl
commit 547b1cdbf5edc567bed762edbda7ea462220f8e0
Author: cypherpunks 
Date:   Fri Apr 21 14:44:55 2017 +

Support bandwidth values that are zero

The boolean value of zero is false in JavaScript. This means that
bandwidth values that are zero are set to 'null'. Null values result in
empty fields in the router details and search pages.

The checks are meant to catch undefined variables so they are replaced
by typeof comparisons which are stricter.

Closes #22039.
---
 js/models/relay.js | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/js/models/relay.js b/js/models/relay.js
index a578e99..ab938af 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -156,11 +156,11 @@ define([
 relay.exit_policy = relay.exit_policy ? relay.exit_policy 
: null;
 relay.exit_policy_summary = relay.exit_policy_summary ?  
relay.exit_policy_summary : null;
 relay.exit_policy_v6_summary = 
relay.exit_policy_v6_summary ?  relay.exit_policy_v6_summary : null;
-relay.bandwidthr = relay.bandwidth_rate ? 
hrBandwidth(relay.bandwidth_rate) : null;
-relay.bandwidthb = relay.bandwidth_burst ? 
hrBandwidth(relay.bandwidth_burst) : null;
-relay.obandwidth = relay.observed_bandwidth ? 
hrBandwidth(relay.observed_bandwidth) : null;
-relay.bandwidth = relay.advertised_bandwidth ? 
relay.advertised_bandwidth : null;
-relay.bandwidth_hr = relay.advertised_bandwidth ? 
hrBandwidth(relay.advertised_bandwidth) : null;
+relay.bandwidthr = (typeof relay.bandwidth_rate !== 
'undefined') ? hrBandwidth(relay.bandwidth_rate) : null;
+relay.bandwidthb = (typeof relay.bandwidth_burst !== 
'undefined') ? hrBandwidth(relay.bandwidth_burst) : null;
+relay.obandwidth = (typeof relay.observed_bandwidth !== 
'undefined') ? hrBandwidth(relay.observed_bandwidth) : null;
+relay.bandwidth = (typeof relay.advertised_bandwidth !== 
'undefined') ? relay.advertised_bandwidth : null;
+relay.bandwidth_hr = (typeof relay.advertised_bandwidth 
!== 'undefined') ? hrBandwidth(relay.advertised_bandwidth) : null;
 relay.effective_family = relay.effective_family ? 
relay.effective_family : null;
 relay.alleged_family = relay.alleged_family ? 
relay.alleged_family : null;
 if (relay.is_bridge) {



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [atlas/master] Use HTTPS on links that support it

2017-04-22 Thread irl
commit f4ab9ad21f5de35c86845081f806b43b3ce74804
Author: cypherpunks 
Date:   Fri Apr 21 21:55:29 2017 +

Use HTTPS on links that support it

Closes #22043.
---
 templates/about.html | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/templates/about.html b/templates/about.html
index fbe08e8..1cff2b4 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -66,9 +66,9 @@ retrieving relay data is called https://onionoo.torproject.org/";>Oniono
 Libraries
 
 Atlas uses http://backbonejs.org/";>Backbone.js as an MV* 
framework, with http://requirejs.org/";>require.js for AMD loading 
of
-dependencies. http://jquery.com/";>jQuery and http://underscorejs.org/";>Underscore.js as JS utility libraries.
-http://datatables.net/";>Datatables for visualizing data in 
tabular form with custom filtering. http://d3js.org";>D3.js for 
making pretty charts.
-http://getbootstrap.com/";>Bootstrap as a CSS framework.
+dependencies. https://jquery.com/";>jQuery and http://underscorejs.org/";>Underscore.js as JS utility libraries.
+https://datatables.net/";>Datatables for visualizing data in 
tabular form with custom filtering. https://d3js.org";>D3.js for 
making pretty charts.
+https://getbootstrap.com/";>Bootstrap as a CSS framework.
 
 
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [atlas/master] Refactor the human readable bandwidth function

2017-04-22 Thread irl
commit ac485a5028de97112edcf3d032a6a65cf1f864ed
Author: cypherpunks 
Date:   Fri Apr 21 14:50:40 2017 +

Refactor the human readable bandwidth function

The number of branches are reduced and the function returns early.
---
 js/helpers.js | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/js/helpers.js b/js/helpers.js
index 96a6296..0d50709 100644
--- a/js/helpers.js
+++ b/js/helpers.js
@@ -251,16 +251,14 @@ var CountryCodes = {
 function hrBandwidth(bw) {
 var bw_k = bw/1000;
 var bw_m = bw_k/1000;
+
 if (bw_m >= 1) {
-bw = Math.round(bw_m*100)/100 + " MB/s";
-} else {
-if (bw_k >= 1) {
-bw = Math.round(bw_k*100)/100 + " KB/s";
-} else {
-bw = bw + " B/s";
-}
+return Math.round(bw_m * 100) / 100 + " MB/s";
+} else if (bw_k >= 1) {
+return Math.round(bw_k * 100) / 100 + " KB/s";
 }
-return bw;
+
+return bw + " B/s";
 }
 
 function checkIfDataIsUpToDate(lastModifiedHeader) {



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits