Commit 04ff4676 authored by Kenton Varda's avatar Kenton Varda

Fix Harris' review comments.

parent 81b9bccc
......@@ -501,7 +501,7 @@ KJ_TEST("NetworkFilter") {
_::NetworkFilter filter({"public"}, {}, base);
KJ_EXPECT(allowed4(filter, "8.8.8.8"));
KJ_EXPECT(!allowed4(base, "240.1.2.3"));
KJ_EXPECT(!allowed4(filter, "240.1.2.3"));
KJ_EXPECT(!allowed4(filter, "192.168.0.1"));
KJ_EXPECT(!allowed4(filter, "10.1.2.3"));
......@@ -518,7 +518,7 @@ KJ_TEST("NetworkFilter") {
_::NetworkFilter filter({"private"}, {"local"}, base);
KJ_EXPECT(!allowed4(filter, "8.8.8.8"));
KJ_EXPECT(!allowed4(base, "240.1.2.3"));
KJ_EXPECT(!allowed4(filter, "240.1.2.3"));
KJ_EXPECT(allowed4(filter, "192.168.0.1"));
KJ_EXPECT(allowed4(filter, "10.1.2.3"));
......@@ -535,7 +535,7 @@ KJ_TEST("NetworkFilter") {
_::NetworkFilter filter({"1.0.0.0/8", "1.2.3.0/24"}, {"1.2.0.0/16", "1.2.3.4/32"}, base);
KJ_EXPECT(!allowed4(filter, "8.8.8.8"));
KJ_EXPECT(!allowed4(base, "240.1.2.3"));
KJ_EXPECT(!allowed4(filter, "240.1.2.3"));
KJ_EXPECT(allowed4(filter, "1.0.0.1"));
KJ_EXPECT(!allowed4(filter, "1.2.2.1"));
......
......@@ -469,12 +469,12 @@ NetworkFilter::NetworkFilter(ArrayPtr<const StringPtr> allow, ArrayPtr<const Str
if (rule == "local") {
denyCidrs.addAll(localCidrs());
} else if (rule == "network") {
KJ_FAIL_REQUIRE("don't deny 'network', allow 'local' isntead");
KJ_FAIL_REQUIRE("don't deny 'network', allow 'local' instead");
} else if (rule == "private") {
denyCidrs.addAll(privateCidrs());
} else if (rule == "public") {
// Tricky: What if we allow 'network' and deny 'public'?
KJ_FAIL_REQUIRE("don't deny 'public', allow 'private' isntead");
KJ_FAIL_REQUIRE("don't deny 'public', allow 'private' instead");
} else if (rule == "unix") {
allowUnix = false;
} else if (rule == "unix-abstract") {
......
......@@ -323,7 +323,7 @@ public:
virtual Own<Network> restrictPeers(
kj::ArrayPtr<const kj::StringPtr> allow,
kj::ArrayPtr<const kj::StringPtr> deny = nullptr) KJ_WARN_UNUSED_RESULT = 0;
// Constructs a new Network instance wrappingc this one which restricts which peer addresses are
// Constructs a new Network instance wrapping this one which restricts which peer addresses are
// permitted (both for outgoing and incoming connections).
//
// Communication will be allowed only with peers whose addresses match one of the patterns
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment