[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release

2021-01-25 Thread translation
commit d04eefe9294fc2e4f4ac8c0a74acad0e19d2ab29
Author: Translation commit bot 
Date:   Tue Jan 26 05:16:47 2021 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
 zh_CN.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/zh_CN.po b/zh_CN.po
index dbf988568a..92a8be410f 100644
--- a/zh_CN.po
+++ b/zh_CN.po
@@ -40,7 +40,7 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-01-05 11:44+0100\n"
-"PO-Revision-Date: 2021-01-26 04:45+\n"
+"PO-Revision-Date: 2021-01-26 04:48+\n"
 "Last-Translator: Siyuan Xu \n"
 "Language-Team: Chinese (China) 
(http://www.transifex.com/otf/torproject/language/zh_CN/)\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/tails-misc] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc

2021-01-25 Thread translation
commit e7b6abd1a65729c8768c91d6630f36f3e23dd0a0
Author: Translation commit bot 
Date:   Tue Jan 26 05:16:00 2021 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc
---
 zh_CN.po | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/zh_CN.po b/zh_CN.po
index 1e43533f5a..a0519a7006 100644
--- a/zh_CN.po
+++ b/zh_CN.po
@@ -40,7 +40,7 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-01-05 11:44+0100\n"
-"PO-Revision-Date: 2021-01-26 04:45+\n"
+"PO-Revision-Date: 2021-01-26 04:48+\n"
 "Last-Translator: Siyuan Xu \n"
 "Language-Team: Chinese (China) 
(http://www.transifex.com/otf/torproject/language/zh_CN/)\n"
 "MIME-Version: 1.0\n"
@@ -1641,15 +1641,15 @@ msgid ""
 "Thunderbird 78 now replaces the Enigmail extension with built-"
 "in support for OpenPGP encryption. To continue using your OpenPGP keys in "
 "Thunderbird, follow our migration instructions."
-msgstr ""
+msgstr "Thunderbird78 现在将Enigmail拓展替换为内置的 
OpenPGP 加密支持。为在 Thunderbird中继续使用你的 OpenPGP 
密钥,请遵循我们的迁移指南。"
 
 #: config/chroot_local-includes/usr/local/bin/thunderbird:44
 msgid "_Open Migration Instructions"
-msgstr ""
+msgstr "_打开迁移指南"
 
 #: config/chroot_local-includes/usr/local/bin/thunderbird:45
 msgid "_Migrate Later"
-msgstr ""
+msgstr "_以后迁移"
 
 #: config/chroot_local-includes/usr/local/bin/tor-browser:46
 msgid "Tor is not ready"

___
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] https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere_completed

2021-01-25 Thread translation
commit c32d0d1da59f3eebb0da2d72a813a90178a2f5df
Author: Translation commit bot 
Date:   Tue Jan 26 05:15:33 2021 +


https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere_completed
---
 zh_CN/https-everywhere.dtd | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/zh_CN/https-everywhere.dtd b/zh_CN/https-everywhere.dtd
index 7c0a5c20e2..d6c09e06e1 100644
--- a/zh_CN/https-everywhere.dtd
+++ b/zh_CN/https-everywhere.dtd
@@ -49,8 +49,8 @@
 
 
 
-
-
+
+
 
 
 
@@ -63,8 +63,8 @@
 
 
 
-
-
+
+
 
 
 

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


[tor-commits] [translation/https_everywhere] https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere

2021-01-25 Thread translation
commit ba5c14e9cfbd5e17743240841e55f4a9560eaa99
Author: Translation commit bot 
Date:   Tue Jan 26 05:15:30 2021 +

https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere
---
 zh_CN/https-everywhere.dtd | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/zh_CN/https-everywhere.dtd b/zh_CN/https-everywhere.dtd
index 7264738477..bbdf93b178 100644
--- a/zh_CN/https-everywhere.dtd
+++ b/zh_CN/https-everywhere.dtd
@@ -49,8 +49,8 @@
 
 
 
-
-
+
+
 
 
 
@@ -63,8 +63,8 @@
 
 
 
-
-
+
+
 
 
 

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


[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release

2021-01-25 Thread translation
commit 5a3a15df23bc0f600db94bcc321649a19de1aee0
Author: Translation commit bot 
Date:   Tue Jan 26 04:46:37 2021 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
 zh_CN.po | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/zh_CN.po b/zh_CN.po
index 64cb57425f..dbf988568a 100644
--- a/zh_CN.po
+++ b/zh_CN.po
@@ -26,6 +26,7 @@
 # Sanya chang <408070...@qq.com>, 2013
 # Scott Rhodes , 2020
 # Simon Koch , 2020
+# Siyuan Xu , 2021
 # khi, 2014
 # Xiaolan , 2014
 # YFdyh000 , 2016
@@ -39,8 +40,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-01-05 11:44+0100\n"
-"PO-Revision-Date: 2021-01-15 07:26+\n"
-"Last-Translator: ff98sha\n"
+"PO-Revision-Date: 2021-01-26 04:45+\n"
+"Last-Translator: Siyuan Xu \n"
 "Language-Team: Chinese (China) 
(http://www.transifex.com/otf/torproject/language/zh_CN/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-misc] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc

2021-01-25 Thread translation
commit bb9b01730092271b4e7602c3eb43d899831fb530
Author: Translation commit bot 
Date:   Tue Jan 26 04:45:53 2021 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc
---
 zh_CN.po | 61 +++--
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/zh_CN.po b/zh_CN.po
index 64cb57425f..1e43533f5a 100644
--- a/zh_CN.po
+++ b/zh_CN.po
@@ -26,6 +26,7 @@
 # Sanya chang <408070...@qq.com>, 2013
 # Scott Rhodes , 2020
 # Simon Koch , 2020
+# Siyuan Xu , 2021
 # khi, 2014
 # Xiaolan , 2014
 # YFdyh000 , 2016
@@ -39,8 +40,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-01-05 11:44+0100\n"
-"PO-Revision-Date: 2021-01-15 07:26+\n"
-"Last-Translator: ff98sha\n"
+"PO-Revision-Date: 2021-01-26 04:45+\n"
+"Last-Translator: Siyuan Xu \n"
 "Language-Team: Chinese (China) 
(http://www.transifex.com/otf/torproject/language/zh_CN/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -206,7 +207,7 @@ msgstr "可用的增量升级需要在 Tails 
的系统分区有 %{space_needed}s
 msgid ""
 "The available incremental upgrade requires {memory_needed} of free memory, "
 "but only {free_memory} is available."
-msgstr ""
+msgstr "可用的增量升级,需要有 {memory_needed} 空闲内
存,而目前仅有 {free_memory} 内存可用。"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:426
 msgid ""
@@ -231,7 +232,7 @@ msgid ""
 "Download size: {size}\n"
 "\n"
 "Do you want to upgrade now?"
-msgstr ""
+msgstr "您应该升级到 {name} 
{version}.\n\n请到{details_url}查看更多å…
³äºŽè¿™ä¸ªæ–°ç‰ˆæœ¬çš„信息。\n\n我们建议您在升级过程中å…
³é—­æ‰€æœ‰æ‰“开的应用程序。\n下载更新可能需要很长时间,从数分钟到数小时不等。\n\n下载文件大小:{size}\n\n您想现在升级吗?"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:451
 msgid "Upgrade available"
@@ -255,7 +256,7 @@ msgid ""
 "It is not possible to automatically upgrade your device to this new version: 
{explanation}.\n"
 "\n"
 "To learn how to do a manual upgrade, go to {manual_upgrade_url}"
-msgstr ""
+msgstr "您应该手动升级到 {name} {version}。\n\n有å…
³æ­¤ç‰ˆæœ¬çš„更多信息请见 
{details_url}。\n\n不能自动升级您的设备到新版本:{explanation}。\n\nå
…³äºŽå¦‚何进行手动升级,请见 {manual_upgrade_url}"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:471
 msgid "New version available"
@@ -268,7 +269,7 @@ msgstr "正在下载升级"
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:554
 #, perl-brace-format
 msgid "Downloading the upgrade to {name} {version}..."
-msgstr ""
+msgstr "正在下载到 {name} {version} 的升级包…"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:614
 msgid ""
@@ -316,7 +317,7 @@ msgid ""
 "The network connection will be disabled when applying the upgrade.\n"
 "\n"
 "Please save your work and close all other applications."
-msgstr ""
+msgstr 
"更新下载成功。\n\n在应用该升级期间网络连接会被禁用。\n\n请保存所有工作,并å
…³é—­å…¶ä»–所有应用程序。"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:700
 msgid "Upgrade successfully downloaded"
@@ -366,11 +367,11 @@ msgstr "关闭网络失败"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:750
 msgid "Error while cancelling the upgrade download"
-msgstr ""
+msgstr "在取消下载升级时出错"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:751
 msgid "Failed to cancel the upgrade download"
-msgstr ""
+msgstr "取消下载升级失败"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:757
 msgid "Upgrading the system"
@@ -381,7 +382,7 @@ msgid ""
 "Your Tails device is being upgraded...\n"
 "\n"
 "For security reasons, the network connection is now disabled."
-msgstr ""
+msgstr "您的 Tails 正在被升级...\n\n由于安全原因
,网络连接已经被禁用。"
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:796
 msgid ""
@@ -551,14 +552,14 @@ msgstr "写入设备,写入速度 %(speed)d MB/s"
 msgid ""
 "There was a problem executing the following command: `%(command)s`.\n"
 "A more detailed error log has been written to \"%(filename)s\"."
-msgstr ""
+msgstr 
"在运行该命令时出错:`%(command)s`。\n更详细的错误日志已被写到
 “%(filename)s”。"
 
 #: 
config/chroot_local-includes/usr/lib/python3/dist-packages/tails_installer/creator.py:424
 #, python-format
 msgid ""
 "Not enough free space on device.\n"
 "%(iso_size)dMB ISO + %(overlay_size)dMB overlay > %(free_space)dMB free space"
-msgstr ""
+msgstr "设备可用空间不足。\n%(iso_size)dMB ISO + %(overlay_size)dMB 
覆盖 > %(free_space)dMB 可用空间"
 
 #: 

[tor-commits] [snowflake/master] Classify proxies with unknown NATs as restricted

2021-01-25 Thread cohosh
commit bae0bacbfdcd7d195e5ecff985bbff2361937170
Author: Cecylia Bocovich 
Date:   Fri Jan 15 11:50:56 2021 -0500

Classify proxies with unknown NATs as restricted
---
 broker/broker.go| 12 ++--
 broker/snowflake-broker_test.go | 17 +
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/broker/broker.go b/broker/broker.go
index 983f95d..b8c7b6c 100644
--- a/broker/broker.go
+++ b/broker/broker.go
@@ -144,10 +144,10 @@ func (ctx *BrokerContext) Broker() {
ctx.snowflakeLock.Lock()
defer ctx.snowflakeLock.Unlock()
if snowflake.index != -1 {
-   if request.natType == NATRestricted {
-   
heap.Remove(ctx.restrictedSnowflakes, snowflake.index)
-   } else {
+   if request.natType == NATUnrestricted {
heap.Remove(ctx.snowflakes, 
snowflake.index)
+   } else {
+   
heap.Remove(ctx.restrictedSnowflakes, snowflake.index)
}
delete(ctx.idToSnowflake, snowflake.id)
close(request.offerChannel)
@@ -169,10 +169,10 @@ func (ctx *BrokerContext) AddSnowflake(id string, 
proxyType string, natType stri
snowflake.offerChannel = make(chan *ClientOffer)
snowflake.answerChannel = make(chan []byte)
ctx.snowflakeLock.Lock()
-   if natType == NATRestricted {
-   heap.Push(ctx.restrictedSnowflakes, snowflake)
-   } else {
+   if natType == NATUnrestricted {
heap.Push(ctx.snowflakes, snowflake)
+   } else {
+   heap.Push(ctx.restrictedSnowflakes, snowflake)
}
ctx.snowflakeLock.Unlock()
ctx.idToSnowflake[id] = snowflake
diff --git a/broker/snowflake-broker_test.go b/broker/snowflake-broker_test.go
index 7b87313..3b59a0f 100644
--- a/broker/snowflake-broker_test.go
+++ b/broker/snowflake-broker_test.go
@@ -29,7 +29,7 @@ func TestBroker(t *testing.T) {
Convey("Adds Snowflake", func() {
So(ctx.snowflakes.Len(), ShouldEqual, 0)
So(len(ctx.idToSnowflake), ShouldEqual, 0)
-   ctx.AddSnowflake("foo", "", NATUnknown)
+   ctx.AddSnowflake("foo", "", NATUnrestricted)
So(ctx.snowflakes.Len(), ShouldEqual, 1)
So(len(ctx.idToSnowflake), ShouldEqual, 1)
})
@@ -37,6 +37,7 @@ func TestBroker(t *testing.T) {
Convey("Broker goroutine matches clients with proxies", func() {
p := new(ProxyPoll)
p.id = "test"
+   p.natType = "unrestricted"
p.offerChannel = make(chan *ClientOffer)
go func(ctx *BrokerContext) {
ctx.proxyPolls <- p
@@ -55,7 +56,7 @@ func TestBroker(t *testing.T) {
Convey("Request an offer from the Snowflake Heap", func() {
done := make(chan *ClientOffer)
go func() {
-   offer := ctx.RequestOffer("test", "", 
NATUnknown)
+   offer := ctx.RequestOffer("test", "", 
NATUnrestricted)
done <- offer
}()
request := <-ctx.proxyPolls
@@ -79,7 +80,7 @@ func TestBroker(t *testing.T) {
Convey("with a proxy answer if available.", func() {
done := make(chan bool)
// Prepare a fake proxy to respond with.
-   snowflake := ctx.AddSnowflake("fake", "", 
NATUnknown)
+   snowflake := ctx.AddSnowflake("fake", "", 
NATUnrestricted)
go func() {
clientOffers(ctx, w, r)
done <- true
@@ -97,7 +98,7 @@ func TestBroker(t *testing.T) {
return
}
done := make(chan bool)
-   snowflake := ctx.AddSnowflake("fake", "", 
NATUnknown)
+   snowflake := ctx.AddSnowflake("fake", "", 
NATUnrestricted)
go func() {
clientOffers(ctx, w, r)
// Takes a few seconds here...
@@ -147,7 +148,7 @@ func TestBroker(t *testing.T) {
})
 
Convey("Responds to proxy answers...", func() {
- 

[tor-commits] [snowflake/master] Bump version of pion/sdp

2021-01-25 Thread cohosh
commit 1b29ad7de14fb0a6d2bf88aea38353733682cd26
Author: Cecylia Bocovich 
Date:   Mon Jan 25 10:28:17 2021 -0500

Bump version of pion/sdp

Update our dependency on pion/sdp from v2 to v3, to match pion/webrtc
v3. This requires some changes in how we parse out addresses from ice
candidates. This will ease tor browser builds of snowflake since we are
now only relying on one version of pion/sdp instead of two different
ones.
---
 common/util/util.go | 9 +
 go.mod  | 3 ++-
 go.sum  | 2 --
 proxy/snowflake.go  | 7 ---
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/common/util/util.go b/common/util/util.go
index 3d2acc3..00f7302 100644
--- a/common/util/util.go
+++ b/common/util/util.go
@@ -5,7 +5,8 @@ import (
"errors"
"net"
 
-   "github.com/pion/sdp/v2"
+   "github.com/pion/ice/v2"
+   "github.com/pion/sdp/v3"
"github.com/pion/webrtc/v3"
 )
 
@@ -77,9 +78,9 @@ func StripLocalAddresses(str string) string {
attrs := make([]sdp.Attribute, 0)
for _, a := range m.Attributes {
if a.IsICECandidate() {
-   ice, err := a.ToICECandidate()
-   if err == nil && ice.Typ == "host" {
-   ip := net.ParseIP(ice.Address)
+   c, err := ice.UnmarshalCandidate(a.Value)
+   if err == nil && c.Type() == 
ice.CandidateTypeHost {
+   ip := net.ParseIP(c.Address())
if ip != nil && (IsLocal(ip) || 
ip.IsUnspecified() || ip.IsLoopback()) {
/* no append in this case */
continue
diff --git a/go.mod b/go.mod
index 2931be7..a7f9ad2 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,8 @@ go 1.13
 require (
git.torproject.org/pluggable-transports/goptlib.git v1.1.0
github.com/gorilla/websocket v1.4.1
-   github.com/pion/sdp/v2 v2.3.4
+   github.com/pion/ice/v2 v2.0.14
+   github.com/pion/sdp/v3 v3.0.3
github.com/pion/stun v0.3.5
github.com/pion/webrtc/v3 v3.0.0
github.com/smartystreets/goconvey v1.6.4
diff --git a/go.sum b/go.sum
index 6214f5c..eac95e1 100644
--- a/go.sum
+++ b/go.sum
@@ -66,8 +66,6 @@ github.com/pion/rtp v1.6.2/go.mod 
h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko
 github.com/pion/sctp v1.7.10/go.mod 
h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
 github.com/pion/sctp v1.7.11 h1:UCnj7MsobLKLuP/Hh+JMiI/6W5Bs/VF45lWKgHFjSIE=
 github.com/pion/sctp v1.7.11/go.mod 
h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
-github.com/pion/sdp/v2 v2.3.4 h1:+f3F5Xl7ynVhc9Il8Dc7BFroYJWG3PMbfWtwFlVI+kg=
-github.com/pion/sdp/v2 v2.3.4/go.mod 
h1:jccXVYW0fuK6ds2pwKr89SVBDYlCjhgMI6nucl5R5rA=
 github.com/pion/sdp/v3 v3.0.3 h1:gJK9hk+JFD2NGIM1nXmqNCq1DkVaIZ9dlA3u3otnkaw=
 github.com/pion/sdp/v3 v3.0.3/go.mod 
h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk=
 github.com/pion/srtp/v2 v2.0.0-rc.3 
h1:1fPiK1nJlNyh235tSGgBnXrPc99wK1/D707f6ntb3qY=
diff --git a/proxy/snowflake.go b/proxy/snowflake.go
index 78a053d..1bc21ab 100644
--- a/proxy/snowflake.go
+++ b/proxy/snowflake.go
@@ -23,7 +23,8 @@ import (
"git.torproject.org/pluggable-transports/snowflake.git/common/util"

"git.torproject.org/pluggable-transports/snowflake.git/common/websocketconn"
"github.com/gorilla/websocket"
-   "github.com/pion/sdp/v2"
+   "github.com/pion/ice/v2"
+   "github.com/pion/sdp/v3"
"github.com/pion/webrtc/v3"
 )
 
@@ -83,9 +84,9 @@ func remoteIPFromSDP(str string) net.IP {
for _, m := range desc.MediaDescriptions {
for _, a := range m.Attributes {
if a.IsICECandidate() {
-   ice, err := a.ToICECandidate()
+   c, err := ice.UnmarshalCandidate(a.Value)
if err == nil {
-   ip := net.ParseIP(ice.Address)
+   ip := net.ParseIP(c.Address())
if ip != nil && isRemoteAddress(ip) {
return ip
}

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


[tor-commits] [sbws/maint-1.1] Merge remote-tracking branch 'gitlab/merge-requests/56' into maint-1.1

2021-01-25 Thread juga
commit 7430b4ef9f4b0371502560126b5342dc4f117371
Merge: 96aadc6 e416547
Author: Georg Koppen 
Date:   Mon Jan 25 14:32:00 2021 +

Merge remote-tracking branch 'gitlab/merge-requests/56' into maint-1.1

 docs/source/how_works.rst|  3 ++-
 docs/source/man_sbws.ini.rst |  4 ++--
 sbws/config.default.ini  | 11 ---
 sbws/core/cleanup.py | 25 -
 sbws/core/generate.py|  9 ++---
 sbws/globals.py  | 12 +---
 6 files changed, 27 insertions(+), 37 deletions(-)

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


[tor-commits] [sbws/maint-1.1] chg: generate, cleanup: Use 28 days of measurements

2021-01-25 Thread juga
commit e416547c73d166bd085a10843c6ba4d1a4167092
Author: juga0 
Date:   Sat Jan 23 09:54:19 2021 +

chg: generate, cleanup: Use 28 days of measurements

When generating the Bandwidth File as Torflow, use 28 days of past raw
measurements instead of 5, by default.
Also keep the raw measurements for that long before compressing or
deleting them.
And stop checking whether the compression and delete
periods are valid, without checking defaults first and based on
arbitrary values.

Closes: #40017
---
 docs/source/how_works.rst|  3 ++-
 docs/source/man_sbws.ini.rst |  4 ++--
 sbws/config.default.ini  | 11 ---
 sbws/core/cleanup.py | 25 -
 sbws/core/generate.py|  9 ++---
 sbws/globals.py  | 12 +---
 6 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/docs/source/how_works.rst b/docs/source/how_works.rst
index f7d7533..24f8689 100644
--- a/docs/source/how_works.rst
+++ b/docs/source/how_works.rst
@@ -137,7 +137,8 @@ Each relay bandwidth measurements are selected in the 
following way:
If they are not, the relay MUST NOT be included in the Bandwith File.
 #. The measurements than are are older than an arbitrary number of senconds
in the past MUST be discarded.
-   Currently this number is the same as ``data_period`` (5 days).
+   Currently this number is the same as ``data_period`` (5 days) when not
+   scaling as Torflow and 28 days when scaling as Torflow.
 
 If the number of relays to include in the Bandwidth File are less than
 a percententage (currently 60%) than the number of relays in the consensus,
diff --git a/docs/source/man_sbws.ini.rst b/docs/source/man_sbws.ini.rst
index e2127ab..31effc7 100644
--- a/docs/source/man_sbws.ini.rst
+++ b/docs/source/man_sbws.ini.rst
@@ -143,9 +143,9 @@ relayprioritizer
 
 cleanup
   data_files_compress_after_days = INT
-After this many days, compress data files. (Default: 10)
+After this many days, compress data files. (Default: 29)
   data_files_delete_after_days = INT
-After this many days, delete data files. (Default: 90)
+After this many days, delete data files. (Default: 57)
   v3bw_files_compress_after_days = INT
 After this many days, compress v3bw files. (Default: 1)
   v3bw_files_delete_after_days = INT
diff --git a/sbws/config.default.ini b/sbws/config.default.ini
index 0105527..c47e4fd 100644
--- a/sbws/config.default.ini
+++ b/sbws/config.default.ini
@@ -71,9 +71,14 @@ extra_lines =
 
 [cleanup]
 # After this many days, compress data files
-data_files_compress_after_days = 10
-# After this many days, delete data files
-data_files_delete_after_days = 90
+# #40017: To generate files as Torflow the result files must be kept for
+# GENERATE_PERIOD seconds.
+# The number of days after they are compressed or deleted could be added
+# as defaults (currently globals.py), and just as a factor of GENERATE_PERIOD.
+data_files_compress_after_days = 29
+# After this many days, delete data files.
+# 57 == 28 * 2 + 1.
+data_files_delete_after_days = 57
 # After this many days, compress v3bw files (1d)
 v3bw_files_compress_after_days = 1
 # After this many days, delete v3bw files (7d)
diff --git a/sbws/core/cleanup.py b/sbws/core/cleanup.py
index aa16fba..1d21989 100644
--- a/sbws/core/cleanup.py
+++ b/sbws/core/cleanup.py
@@ -99,28 +99,6 @@ def _check_validity_periods_v3bw(compress_after_days, 
delete_after_days):
   "after a bigger number of days.")
 
 
-def _check_validity_periods_results(
-data_period, compress_after_days, delete_after_days):
-if compress_after_days - 2 < data_period:
-fail_hard(
-'For safetly, cleanup/data_files_compress_after_days (%d) must be '
-'at least 2 days larger than general/data_period (%d)',
-compress_after_days, data_period)
-if delete_after_days < compress_after_days:
-fail_hard(
-'cleanup/data_files_delete_after_days (%d) must be the same or '
-'larger than cleanup/data_files_compress_after_days (%d)',
-delete_after_days, compress_after_days)
-if compress_after_days / 2 < data_period:
-log.warning(
-'cleanup/data_files_compress_after_days (%d) is less than twice '
-'general/data_period (%d). For ease of parsing older results '
-'if necessary, it is recommended to make '
-'data_files_compress_after_days at least twice the data_period.',
-compress_after_days, data_period)
-return True
-
-
 def _clean_v3bw_files(args, conf):
 v3bw_dname = conf.getpath('paths', 'v3bw_dname')
 if not os.path.isdir(v3bw_dname):
@@ -147,13 +125,10 @@ def _clean_result_files(args, conf):
 datadir = conf.getpath('paths', 'datadir')
 if not os.path.isdir(datadir):
 fail_hard('%s does not exist', datadir)
-data_period = conf.getint('general', 'data_period')
 compress_after_days = 

[tor-commits] [sbws/maint-1.1] Merge branch 'bug_40036_v3' into 'maint-1.1'

2021-01-25 Thread juga
commit 38649f0f938bcc4496fd47699cc4f29f78547293
Merge: 6dc6e94 c931dd0
Author: juga 
Date:   Thu Jan 14 10:23:06 2021 +

Merge branch 'bug_40036_v3' into 'maint-1.1'

fix: doc: Sphinx warnings when creating documentation

Closes #40036

See merge request tpo/network-health/sbws!54

 AUTHORS.md   | 3 ++-
 README.md| 3 ++-
 docs/source/conf.py  | 2 +-
 docs/source/torflow_aggr.rst | 2 +-
 sbws/lib/relaylist.py| 5 +++--
 sbws/lib/relayprioritizer.py | 1 +
 sbws/lib/resultdump.py   | 2 +-
 sbws/lib/v3bwfile.py | 2 +-
 sbws/util/stem.py| 3 ++-
 9 files changed, 14 insertions(+), 9 deletions(-)



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


[tor-commits] [sbws/maint-1.1] fix: doc: Add forgotten image from consensus health

2021-01-25 Thread juga
commit 8805a1d2f68260a3f996e16a8938aff954af6172
Author: juga0 
Date:   Mon Jan 11 07:37:25 2021 +

fix: doc: Add forgotten image from consensus health

It was referenced by 6e6a8f3ba534cbd93b830fe3ffd5ce40abe8e77d. Since that
image was wrong, created a new screenshot from the current "past 90
days" at consensus-health.tpo.
---
 .../source/images/20210111_consensushealth_bwauths.png | Bin 0 -> 100029 bytes
 docs/source/monitoring_bandwidth.rst   |   2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/source/images/20210111_consensushealth_bwauths.png 
b/docs/source/images/20210111_consensushealth_bwauths.png
new file mode 100644
index 000..6898fd2
Binary files /dev/null and 
b/docs/source/images/20210111_consensushealth_bwauths.png differ
diff --git a/docs/source/monitoring_bandwidth.rst 
b/docs/source/monitoring_bandwidth.rst
index d9ebdf2..b3a6c65 100644
--- a/docs/source/monitoring_bandwidth.rst
+++ b/docs/source/monitoring_bandwidth.rst
@@ -15,7 +15,7 @@ Bwauths number of measured relays
 
 It should be approximately equal for all bwauths.
 
-.. image:: images/20200927_consensushealth_bwauths.png
+.. image:: images/20210111_consensushealth_bwauths.png
:alt: bwauths measured relays
 
 https://consensus-health.torproject.org/graphs.html#votedaboutgraphs



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


[tor-commits] [sbws/maint-1.1] Merge remote-tracking branch 'gitlab/merge-requests/51' into maint-1.1

2021-01-25 Thread juga
commit 96aadc69d0da29d2b85cba08c549c9ccf82a70fc
Merge: 38649f0 a050110
Author: Georg Koppen 
Date:   Mon Jan 25 11:21:59 2021 +

Merge remote-tracking branch 'gitlab/merge-requests/51' into maint-1.1

 sbws/lib/relaylist.py| 17 +
 tests/unit/lib/test_relaylist.py |  8 
 2 files changed, 9 insertions(+), 16 deletions(-)

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


[tor-commits] [sbws/maint-1.1] fix: doc: Sphinx warnings when creating documentation

2021-01-25 Thread juga
commit c931dd014e7fce265da9a46dd48fb9c304c0efeb
Author: Georg Koppen 
Date:   Mon Dec 21 09:30:39 2020 +

fix: doc: Sphinx warnings when creating documentation

This should give us at least a clean html, text, and man build
experience.

Closes #40036.
---
 AUTHORS.md   | 3 ++-
 README.md| 3 ++-
 docs/source/conf.py  | 2 +-
 docs/source/torflow_aggr.rst | 2 +-
 sbws/lib/relaylist.py| 5 +++--
 sbws/lib/relayprioritizer.py | 1 +
 sbws/lib/resultdump.py   | 2 +-
 sbws/lib/v3bwfile.py | 2 +-
 sbws/util/stem.py| 3 ++-
 9 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/AUTHORS.md b/AUTHORS.md
index 4eaef8f..1e8641e 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -1,4 +1,5 @@
-# Authors
+Authors
+===
 
 The following people have contributed to Simple Bandwidth Scanner.
 Thank you for helping make Tor better.
diff --git a/README.md b/README.md
index 852d02c..fe12cba 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
-# Readme
+Readme
+==
 
 [![Build 
Status](https://travis-ci.org/torproject/sbws.svg?branch=master)](https://travis-ci.org/https://travis-ci.org/torproject/sbws)
 
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 3dc8660..1f33c71 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -97,7 +97,7 @@ html_theme = 'nature'
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+html_static_path = []
 
 # Custom sidebar templates, must be a dictionary that maps document names
 # to template names.
diff --git a/docs/source/torflow_aggr.rst b/docs/source/torflow_aggr.rst
index 5b4b3fd..bc9420d 100644
--- a/docs/source/torflow_aggr.rst
+++ b/docs/source/torflow_aggr.rst
@@ -426,4 +426,4 @@ oldest measurements are 5 days old::
 .. _SQLSupport.py: 
https://gitweb.torproject.org/pytorctl.git/tree/SQLSupport.py#n493
 .. _bandwidth file spec: 
https://gitweb.torproject.org/torspec.git/tree/bandwidth-file-spec.txt
 .. _aggregate.py: 
https://gitweb.torproject.org/torflow.git/tree/NetworkScanners/BwAuthority/aggregate.py
-.. _TorCtly.py: https://gitweb.torproject.org/pytorctl.git/tree/TorCtl.py
+.. _TorCtl.py: https://gitweb.torproject.org/pytorctl.git/tree/TorCtl.py
diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index 8a07ce7..bc6b5ce 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -24,6 +24,7 @@ def valid_after_from_network_statuses(network_statuses):
 attribute of a ``stem.descriptor.RouterStatusEntryV3``.
 
 :param list network_statuses:
+
 returns datetime:
 """
 for ns in network_statuses:
@@ -228,7 +229,7 @@ class Relay:
 Increment The number of times that a relay has been queued
 to be measured.
 
-It is call from :funf:`~sbws.core.scaner.main_loop`.
+It is call from :func:`~sbws.core.scaner.main_loop`.
 """
 self.relay_recent_measurement_attempt.update()
 
@@ -468,7 +469,7 @@ class RelayList:
 Increment the number of times that any relay has been queued to be
 measured.
 
-It is call from :funf:`~sbws.core.scaner.main_loop`.
+It is call from :func:`~sbws.core.scaner.main_loop`.
 
 It is read and stored in a ``state`` file.
 """
diff --git a/sbws/lib/relayprioritizer.py b/sbws/lib/relayprioritizer.py
index ef45391..2d6a488 100644
--- a/sbws/lib/relayprioritizer.py
+++ b/sbws/lib/relayprioritizer.py
@@ -97,6 +97,7 @@ class RelayPrioritizer:
 measurements that did not succed.
 :param bool return_fraction: whether to return only a fraction of the
 relays seen in the network or return all.
+
 return: a generator of the new ordered list of relays to measure next.
 
 """
diff --git a/sbws/lib/resultdump.py b/sbws/lib/resultdump.py
index 9792fde..542837e 100644
--- a/sbws/lib/resultdump.py
+++ b/sbws/lib/resultdump.py
@@ -558,7 +558,7 @@ class ResultErrorSecondRelay(ResultError):
 
 A second suitable relay is a relay that:
 - Has at least equal bandwidth as the relay to measure.
-- If the relay to measure is not an exit,
+- If the relay to measure is not an exit, \
   the second relay is an exit without `bad` flag and can exit to port 443.
 - If the relay to measure is an exit, the second relay is not an exit.
 
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index 553265b..362c696 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -625,7 +625,7 @@ class V3BWLine(object):
 :param dict kwargs: extra headers.
 
 .. note:: tech-debt: move node_id and bw to kwargs and just ensure that
-   the required values are in **kwargs
+   the required values are in ``**kwargs``
 """
 def __init__(self, node_id, bw, 

[tor-commits] [sbws/maint-1.1] Merge remote-tracking branch 'gitlab/merge-requests/53' into maint-1.1

2021-01-25 Thread juga
commit 6dc6e94bd0509ddc329c14f3edc4188bfa9716e8
Merge: c40e6e1 8805a1d
Author: Georg Koppen 
Date:   Mon Jan 11 09:28:54 2021 +

Merge remote-tracking branch 'gitlab/merge-requests/53' into maint-1.1

 .../source/images/20210111_consensushealth_bwauths.png | Bin 0 -> 100029 bytes
 docs/source/monitoring_bandwidth.rst   |   2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)



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


[tor-commits] [sbws/maint-1.1] fix: relaylist: Stop measuring relays not in the consenus

2021-01-25 Thread juga
commit a050110db59d136f6f46809c4b18fe487012e546
Author: juga0 
Date:   Mon Dec 21 16:24:50 2020 +

fix: relaylist: Stop measuring relays not in the consenus

as this might cause many circuit errors.
They're already added to the generator.
Also adapt the number in test_init_relays.

Closes: #40037.

Happy solstice! :)
---
 sbws/lib/relaylist.py| 17 +
 tests/unit/lib/test_relaylist.py |  8 
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index 8a07ce7..640e3eb 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -14,7 +14,7 @@ from ..globals import (
 MAX_RECENT_PRIORITY_LIST_COUNT,
 MEASUREMENTS_PERIOD
 )
-from ..util import timestamp, timestamps
+from ..util import timestamps
 
 log = logging.getLogger(__name__)
 
@@ -250,12 +250,6 @@ class Relay:
 def relay_recent_priority_list_count(self):
 return len(self.relay_recent_priority_list)
 
-def is_old(self):
-"""Whether the last consensus seen for this relay is older than the
-measurement period.
-"""
-return timestamp.is_old(self.last_consensus_timestamp)
-
 # XXX: tech-debt: replace `_desc` attr by a a `dequee` of the last
 # descriptors seen for this relay and the timestamp.
 def update_server_descriptor(self, server_descriptor):
@@ -417,11 +411,10 @@ class RelayList:
 # already added to the new list.
 new_relays_dict.pop(fp)
 
-# If the relay is not in the current consensus but is not "old"
-# yet, add it to the new list of relays too, though its timestamp,
-# router status and descriptor can't be updated.
-elif not r.is_old():
-new_relays.append(r)
+# In #30727, the relay that is not in the current conensus but is
+# not "old", was added to the new list of relays too.
+# In #40037 we think it should not be measured, as it might cause
+# many circuit errors. It's already added to the generator.
 # Otherwise, don't add it to the new list of relays.
 # For debugging, count the old relays that will be discarded.
 else:
diff --git a/tests/unit/lib/test_relaylist.py b/tests/unit/lib/test_relaylist.py
index 31673ba..399d897 100644
--- a/tests/unit/lib/test_relaylist.py
+++ b/tests/unit/lib/test_relaylist.py
@@ -51,7 +51,7 @@ def test_init_relays(
 assert 6505 == 6433 + len(added_fps)
 # The calculated min bw for the second hop
 assert 212 == relay_list._exit_min_bw
-assert 20 == relay_list._non_exit_min_bw
+assert 21 == relay_list._non_exit_min_bw
 
 # Five days later plus 1 second.
 # The first consensus timestamp will get removed.
@@ -69,10 +69,10 @@ def test_init_relays(
 removed_fps = fps.difference(fps_5days_later)
 # The number of relays will be the number of relays in the cosensus plus
 # the added ones minus the removed ones.
-assert 6925 == 6505 + len(added_fps) - len(removed_fps)
+assert 6596 == 6505 + len(added_fps) - len(removed_fps)
 # The calculated min bw for the second hop
-assert 279 == relay_list._exit_min_bw
-assert 11 == relay_list._non_exit_min_bw
+assert 280 == relay_list._exit_min_bw
+assert 15 == relay_list._non_exit_min_bw
 
 
 def test_increment_recent_measurement_attempt(args, conf, controller):



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


[tor-commits] [sbws/maint-1.1] Merge branch 'bug_40035' into 'maint-1.1'

2021-01-25 Thread juga
commit e37c47238f3cbea71efa0ad4ef237f8e1423efd6
Merge: 713d400 17e6eca
Author: juga 
Date:   Thu Jan 7 15:51:35 2021 +

Merge branch 'bug_40035' into 'maint-1.1'

fix: doc: Update values in config_tor.rst + clean-up

Closes #40035

See merge request tpo/network-health/sbws!49

 docs/source/config_tor.rst | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)



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


[tor-commits] [sbws/maint-1.1] Merge remote-tracking branch 'gitlab/merge-requests/50' into maint-1.1

2021-01-25 Thread juga
commit c40e6e11f3d064f7c5fc8ec1895081ae673781fc
Merge: e37c472 cb6a8a7
Author: Georg Koppen 
Date:   Thu Jan 7 22:55:33 2021 +

Merge remote-tracking branch 'gitlab/merge-requests/50' into maint-1.1

 docs/source/man_sbws.ini.rst  |  4 +++
 sbws/config.default.ini   |  1 +
 sbws/core/scanner.py  | 18 ++--
 sbws/util/config.py   |  4 ++-
 sbws/util/stem.py | 66 +--
 tests/integration/conftest.py |  4 +--
 6 files changed, 45 insertions(+), 52 deletions(-)



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


[tor-commits] [sbws/maint-1.1] fix: stem: Add possible exception cause

2021-01-25 Thread juga
commit cb6a8a76da0d77ef2896c9f99003649b3d43c1b4
Author: juga0 
Date:   Wed Dec 16 15:55:13 2020 +

fix: stem: Add possible exception cause
---
 sbws/util/stem.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index 5605c29..ce5253c 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -181,9 +181,12 @@ def set_torrc_options_can_fail(controller):
 for k, v in TORRC_OPTIONS_CAN_FAIL.items():
 try:
 controller.set_conf(k, v)
-except InvalidArguments as error:
+except (InvalidArguments, InvalidRequest) as error:
 log.debug('Ignoring option not supported by this Tor version. %s',
   error)
+except ControllerError as e:
+log.exception(e)
+exit(1)
 
 
 def launch_tor(conf):



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


[tor-commits] [sbws/maint-1.1] chg: stem: Add function to connect or start tor

2021-01-25 Thread juga
commit f7847ed28cab55bd1260d307b42c4ef59772937a
Author: juga0 
Date:   Wed Dec 16 15:51:55 2020 +

chg: stem: Add function to connect or start tor

Move initialization via existing socket to this new function and start
tor only when it fails.

Closes: #33150.
---
 sbws/core/scanner.py  | 17 ++---
 sbws/util/stem.py | 22 --
 tests/integration/conftest.py |  4 ++--
 3 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index bcbeb47..312993a 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -679,21 +679,8 @@ def run_speedtest(args, conf):
 
 """
 global rd, pool, controller
-controller = stem_utils.init_controller(conf)
-if not controller:
-controller = stem_utils.launch_tor(conf)
-else:
-log.warning(
-'Is sbws already running? '
-'We found an existing Tor process at %s. We are not going to '
-'launch Tor, nor are we going to try to configure it to behave '
-'like we expect. This might work okay, but it also might not. '
-'If you experience problems, you should try letting sbws launch '
-'Tor for itself. The ability to use an already running Tor only '
-'exists for sbws developers. It is expected to be broken and may '
-'even lead to messed up results.',
-conf.getpath('tor', 'control_socket'))
-time.sleep(15)
+
+controller = stem_utils.launch_or_connect_to_tor(conf)
 
 # When there will be a refactor where conf is global, this can be removed
 # from here.
diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index 169acda..5605c29 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -6,7 +6,6 @@ from stem import (SocketError, InvalidRequest, 
UnsatisfiableRequest,
   ProtocolError, SocketClosed)
 from stem.connection import IncorrectSocketType
 import stem.process
-from configparser import ConfigParser
 from threading import RLock
 import copy
 import logging
@@ -68,10 +67,8 @@ def init_controller(conf):
 control_port = int(control_port)
 # If it can not connect, the program will exit here
 c = _init_controller_port(control_port)
-else:
-c = _init_controller_socket(
-socket=conf.getpath('tor', 'control_socket')
-)
+# There is no configuration for external control socket, therefore do not
+# attempt to connect to the control socket.
 return c
 
 
@@ -190,7 +187,6 @@ def set_torrc_options_can_fail(controller):
 
 
 def launch_tor(conf):
-assert isinstance(conf, ConfigParser)
 os.makedirs(conf.getpath('tor', 'datadir'), mode=0o700, exist_ok=True)
 os.makedirs(conf.getpath('tor', 'log'), exist_ok=True)
 os.makedirs(conf.getpath('tor', 'run_dpath'), mode=0o700, exist_ok=True)
@@ -216,6 +212,8 @@ def launch_tor(conf):
 torrc = parse_user_torrc_config(torrc, conf['tor']['extra_lines'])
 # Finally launch Tor
 try:
+# If there is already a tor process running with the same control
+# socket, this will exit here.
 stem.process.launch_tor_with_config(
 torrc, init_msg_handler=log.debug, take_ownership=True)
 except Exception as e:
@@ -223,6 +221,18 @@ def launch_tor(conf):
 log.info("Started own tor.")
 # And return a controller to it
 cont = _init_controller_socket(conf.getpath('tor', 'control_socket'))
+# In the case it was not possible to connect to own tor socket.
+if not cont:
+fail_hard('Could not connect to own tor control socket.')
+return cont
+
+
+def launch_or_connect_to_tor(conf):
+# If connecting to an existing controller, there is no need to configure
+# own tor.
+cont = init_controller(conf)
+if not cont:
+cont = launch_tor(conf)
 # Set options that can fail at runtime
 set_torrc_options_can_fail(cont)
 # Set runtime options
diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py
index afd7256..2c0e675 100644
--- a/tests/integration/conftest.py
+++ b/tests/integration/conftest.py
@@ -7,7 +7,7 @@ from sbws.lib.circuitbuilder import GapsCircuitBuilder as CB
 from sbws.lib.destination import DestinationList
 from sbws.lib.relaylist import RelayList
 from sbws.util.config import _get_default_config
-from sbws.util.stem import launch_tor
+from sbws.util.stem import launch_or_connect_to_tor
 
 
 class _PseudoArguments(argparse.Namespace):
@@ -91,7 +91,7 @@ SafeLogging 0
 
 @pytest.fixture(scope='session')
 def persistent_launch_tor(conf):
-cont = launch_tor(conf)
+cont = launch_or_connect_to_tor(conf)
 return cont
 
 



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


[tor-commits] [sbws/maint-1.1] fix: stem: Remove unused code

2021-01-25 Thread juga
commit 553f4a8fa35a35b686c27a808671b0c1f0f76807
Author: juga0 
Date:   Wed Dec 16 15:27:55 2020 +

fix: stem: Remove unused code
---
 sbws/util/stem.py | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index d2c596f..746fa88 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -80,13 +80,6 @@ def init_controller(port=None, path=None, 
set_custom_stream_settings=True):
 if not c:
 return None, 'Unable to reach tor on control socket'
 assert c is not None
-if set_custom_stream_settings:
-# These options are also set in launch_tor.
-# In a future refactor they could be set in the case they are not
-# already in the running instance. This way the controller_port
-# could also be used.
-set_torrc_options_can_fail(c)
-set_torrc_runtime_options(c)
 return c, ''
 
 



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


[tor-commits] [sbws/maint-1.1] fix: doc: Update values in config_tor.rst + clean-up

2021-01-25 Thread juga
commit 17e6eca63645271cbf2f5553b1a71aafd3f542cd
Author: Georg Koppen 
Date:   Thu Jan 7 14:38:00 2021 +

fix: doc: Update values in config_tor.rst + clean-up

Closes #40035.
---
 docs/source/config_tor.rst | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/docs/source/config_tor.rst b/docs/source/config_tor.rst
index 175a9ff..e609468 100644
--- a/docs/source/config_tor.rst
+++ b/docs/source/config_tor.rst
@@ -3,7 +3,7 @@
 Internal Tor configuration for the scanner
 --
 
-The scanner needs an specific Tor configuration.
+The scanner needs a specific Tor configuration.
 The following options are either set when launching Tor or required when
 connection to an existing Tor daemon.
 
@@ -16,6 +16,9 @@ Default configuration:
 - ``SafeLogging 0``: Useful for logging, since there's no need for anonymity.
 - ``LogTimeGranularity 1``
 - ``ProtocolWarnings 1``
+- ``FetchDirInfoEarly 1``
+- ``FetchDirInfoExtraEarly 1``: Respond to `MaxAdvertisedBandwidth` as soon as 
possible.
+- ``FetchUselessDescriptors 1``: Keep fetching descriptors, even when idle.
 - ``LearnCircuitBuildTimeout 0``: To keep circuit build timeouts static.
 
 Configuration that depends on the user configuration file:
@@ -29,9 +32,13 @@ Configuration that depends on the user configuration file:
 Configuration that needs to be set on runtime:
 
 - ``__DisablePredictedCircuits 1``: To build custom circuits.
-- ``__LeaveStreamsUnattached 1``
+- ``__LeaveStreamsUnattached 1``: The scanner is attaching the streams itself.
+
+Configuration that can be set on runtime and fail:
+
+- ``ConnectionPadding 0``: Useful for avoiding extra traffic, since scanner 
anonymity is not a goal.
 
 Currently most of the code that sets this configuration is in 
:func:`sbws.util.stem.launch_tor`
 and the default configuration is ``sbws/globals.py``.
 
-.. note:: the location of these code is being refactored.
\ No newline at end of file
+.. note:: the location of this code is being refactored.



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


[tor-commits] [sbws/maint-1.1] fix: stem: Exit on failure connecting to control port

2021-01-25 Thread juga
commit 6cfd60ed6272afa15458d893ffbbe2fe3703f87c
Author: juga0 
Date:   Wed Dec 16 15:21:44 2020 +

fix: stem: Exit on failure connecting to control port

because when trying to connect to an external tor (chutney), it does
not make sense to start own tor.
Also log how the connection has been made.
---
 sbws/util/stem.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index 05f8e90..d2c596f 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -110,8 +110,9 @@ def _init_controller_port(port):
 c = Controller.from_port(port=port)
 c.authenticate()
 except (IncorrectSocketType, SocketError):
-return None
+fail_hard("Unable to connect to control port %s.", port)
 # TODO: Allow for auth via more than just CookieAuthentication
+log.info("Connected to tor via port %s", port)
 return c
 
 
@@ -127,6 +128,7 @@ def _init_controller_socket(socket):
 log.exception("Error initting controller socket: %s", e)
 return None
 # TODO: Allow for auth via more than just CookieAuthentication
+log.info("Connected to tor via socket %s", socket)
 return c
 
 
@@ -233,6 +235,7 @@ def launch_tor(conf):
 torrc, init_msg_handler=log.debug, take_ownership=True)
 except Exception as e:
 fail_hard('Error trying to launch tor: %s', e)
+log.info("Started own tor.")
 # And return a controller to it
 cont = _init_controller_socket(conf.getpath('tor', 'control_socket'))
 # Set options that can fail at runtime
@@ -240,8 +243,7 @@ def launch_tor(conf):
 # Set runtime options
 set_torrc_runtime_options(cont)
 
-log.info('Started and connected to Tor %s via %s', cont.get_version(),
- conf.getpath('tor', 'control_socket'))
+log.info('Started or connected to Tor %s.', cont.get_version())
 return cont
 
 



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


[tor-commits] [sbws/maint-1.1] chg: config: Add option to connect to external tor

2021-01-25 Thread juga
commit f6e300c83508508a6f38abe76390f9c6c3de00a2
Author: juga0 
Date:   Wed Dec 16 15:14:48 2020 +

chg: config: Add option to connect to external tor

via control port.
---
 docs/source/man_sbws.ini.rst | 4 
 sbws/config.default.ini  | 1 +
 sbws/util/config.py  | 4 +++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/docs/source/man_sbws.ini.rst b/docs/source/man_sbws.ini.rst
index f878ce8..e2127ab 100644
--- a/docs/source/man_sbws.ini.rst
+++ b/docs/source/man_sbws.ini.rst
@@ -93,6 +93,10 @@ tor
 sbws's owned tor pid file. (Default: ~/.sbws/tor/sbws/tor.pid)
   log = STR
 sbws's owned tor directory log files. (Default: ~/.sbws/tor/log)
+  external_control_port = INT
+tor control port to connect to. Useful to run integration tests with
+chutney.
+(Default: not set. If set, it takes preference over the control socket)
   extra_lines =
 sbws's tor extra configuration. (Default: None)
 
diff --git a/sbws/config.default.ini b/sbws/config.default.ini
index cb943d0..0105527 100644
--- a/sbws/config.default.ini
+++ b/sbws/config.default.ini
@@ -66,6 +66,7 @@ control_socket = ${tor:run_dpath}/control
 pid = ${tor:run_dpath}/tor.pid
 # note this is a directory
 log = ${tor:datadir}/log
+external_control_port =
 extra_lines =
 
 [cleanup]
diff --git a/sbws/util/config.py b/sbws/util/config.py
index e1bc429..5ba3fd5 100644
--- a/sbws/util/config.py
+++ b/sbws/util/config.py
@@ -323,7 +323,9 @@ def _validate_tor(conf):
 sec = 'tor'
 err_tmpl = Template('$sec/$key ($val): $e')
 unvalidated_keys = [
-'datadir', 'run_dpath', 'control_socket', 'pid', 'log', 'extra_lines']
+'datadir', 'run_dpath', 'control_socket', 'pid', 'log',
+'external_control_port', 'extra_lines',
+]
 all_valid_keys = unvalidated_keys
 errors.extend(_validate_section_keys(conf, sec, all_valid_keys, err_tmpl))
 return errors



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


[tor-commits] [sbws/maint-1.1] chg: stem, scanner: Change args initializing controller

2021-01-25 Thread juga
commit 80f379ac5f12078ca358d7645beee5f4278acd95
Author: juga0 
Date:   Wed Dec 16 15:39:31 2020 +

chg: stem, scanner: Change args initializing controller

to check whether the external control port configuration is set.
There is no need to assert all argument options nor to return the error.
---
 sbws/core/scanner.py |  3 +--
 sbws/util/stem.py| 30 +++---
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index 5e6cac3..bcbeb47 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -679,8 +679,7 @@ def run_speedtest(args, conf):
 
 """
 global rd, pool, controller
-controller, _ = stem_utils.init_controller(
-path=conf.getpath('tor', 'control_socket'))
+controller = stem_utils.init_controller(conf)
 if not controller:
 controller = stem_utils.launch_tor(conf)
 else:
diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index 746fa88..169acda 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -60,27 +60,19 @@ def remove_event_listener(controller, func):
 log.exception("Exception trying to remove event %s", e)
 
 
-def init_controller(port=None, path=None, set_custom_stream_settings=True):
-# NOTE: we do not currently support a control port even though the rest of
-# this function will pretend like port could be set.
-assert port is None
-# make sure only one is set
-assert port is not None or path is not None
-assert not (port is not None and path is not None)
-# and for the one that is set, make sure it is likely valid
-assert port is None or isinstance(port, int)
-assert path is None or isinstance(path, str)
+def init_controller(conf):
 c = None
-if port:
-c = _init_controller_port(port)
-if not c:
-return None, 'Unable to reach tor on control port'
+# If the external control port is set, use it to initialize the controller.
+control_port = conf['tor']['external_control_port']
+if control_port:
+control_port = int(control_port)
+# If it can not connect, the program will exit here
+c = _init_controller_port(control_port)
 else:
-c = _init_controller_socket(path)
-if not c:
-return None, 'Unable to reach tor on control socket'
-assert c is not None
-return c, ''
+c = _init_controller_socket(
+socket=conf.getpath('tor', 'control_socket')
+)
+return c
 
 
 def is_bootstrapped(c):



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


[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release

2021-01-25 Thread translation
commit cc0273ec8a3f60d1cde0f3ac1a6e40ce6fb12242
Author: Translation commit bot 
Date:   Mon Jan 25 09:16:42 2021 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
 es.po | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/es.po b/es.po
index e89b5c1c00..919477d249 100644
--- a/es.po
+++ b/es.po
@@ -8,7 +8,7 @@
 # Edward Navarro, 2015
 # vareli , 2020
 # el buve, 2015
-# Emma Peel, 2015,2017-2020
+# Emma Peel, 2015,2017-2021
 # eulalio barbero espinosa , 2018-2021
 # Joaquín Serna , 2019,2021
 # Jose Luis Tirado , 2014-2015
@@ -21,8 +21,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-01-05 11:44+0100\n"
-"PO-Revision-Date: 2021-01-23 01:27+\n"
-"Last-Translator: Joaquín Serna \n"
+"PO-Revision-Date: 2021-01-25 08:59+\n"
+"Last-Translator: Emma Peel\n"
 "Language-Team: Spanish 
(http://www.transifex.com/otf/torproject/language/es/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -166,7 +166,7 @@ msgstr "no hay suficiente memoria libre en este sistema"
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:338
 #, perl-brace-format
 msgid "No explanation available for reason '{reason}'."
-msgstr "No hay explicación disponible para la razón '{razón}'."
+msgstr "No hay explicación disponible para la razón '{reason}'."
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:359
 msgid "The system is up-to-date"

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


[tor-commits] [translation/tails-misc] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc

2021-01-25 Thread translation
commit 49086df09a77a2d90e506ec372892d860fa25ae5
Author: Translation commit bot 
Date:   Mon Jan 25 09:15:55 2021 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc
---
 es.po | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/es.po b/es.po
index e65b54561b..43bd28ab01 100644
--- a/es.po
+++ b/es.po
@@ -8,7 +8,7 @@
 # Edward Navarro, 2015
 # vareli , 2020
 # el buve, 2015
-# Emma Peel, 2015,2017-2020
+# Emma Peel, 2015,2017-2021
 # eulalio barbero espinosa , 2018-2021
 # Joaquín Serna , 2019,2021
 # Jose Luis Tirado , 2014-2015
@@ -21,8 +21,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-01-05 11:44+0100\n"
-"PO-Revision-Date: 2021-01-23 01:27+\n"
-"Last-Translator: Joaquín Serna \n"
+"PO-Revision-Date: 2021-01-25 08:59+\n"
+"Last-Translator: Emma Peel\n"
 "Language-Team: Spanish 
(http://www.transifex.com/otf/torproject/language/es/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -166,7 +166,7 @@ msgstr "no hay suficiente memoria libre en este sistema"
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:338
 #, perl-brace-format
 msgid "No explanation available for reason '{reason}'."
-msgstr "No hay explicación disponible para la razón '{razón}'."
+msgstr "No hay explicación disponible para la razón '{reason}'."
 
 #: config/chroot_local-includes/usr/src/iuk/lib/Tails/IUK/Frontend.pm:359
 msgid "The system is up-to-date"

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