MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / isLocalAddress

Method isLocalAddress

sources/utils/NetOrigin.cpp:35–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& local)
36{
37 if (address.protocol() == QAbstractSocket::IPv4Protocol)
38 {
39 if (!address.isInSubnet(local, 24)) // 255.255.255.xxx; IPv4 0-32
40 {
41 return false;
42 }
43 }
44 else if (address.protocol() == QAbstractSocket::IPv6Protocol)
45 {
46 if (!address.isInSubnet(local, 64)) // 2001:db8:abcd:0012:XXXX:XXXX:XXXX:XXXX; IPv6 0-128
47 {
48 return false;
49 }
50 }
51 return true;
52}
53
54void NetOrigin::settingsChangedHandler(settings::type type, const QJsonDocument& config)
55{

Callers 2

newConnectionMethod · 0.80
onClientConnectedMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected