-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix checking whether source address in X-Forwarded-For is ipv4 or ipv6 #72
Conversation
f88b73d
to
b5092fd
Compare
b5092fd
to
09df500
Compare
09df500
to
368bb5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
return ipChecker.isV6AddressExternal(clientAddrBinary); | ||
} | ||
|
||
static bool isClientExternal(const IpAddressChecker& ipChecker, const std::string& addr, bool isIpV6) { | ||
return isIpV6 ? isIpv6ClientExternal(ipChecker, addr) : isIpv4ClientExternal(ipChecker, addr); | ||
static bool isClientExternal(const IpAddressChecker& ipChecker, const std::string& addr, bool isIpv6) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static bool isClientExternal(const IpAddressChecker& ipChecker, const std::string& addr, bool isIpv6) { | |
static bool isClientExternal(const IpAddressChecker& ipChecker, const std::string& addr, bool isPossiblyIpv6) { |
} | ||
|
||
static bool isClientExternal(const IpAddressChecker& ipChecker, const std::string& addr) { | ||
bool isPossiblyIpv6{std::count(addr.begin(), addr.end(), ':') >= 2}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that Ipv6-checking logic should not be hidden inside a isClientExternal
wrapper and should rather be called outside isClientExternal
.
No description provided.