#include "services/network/public/cpp/ip_address_space_util.h"
#include <utility>
#include "base/command_line.h"
#include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/transport_info.h"
#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/mojom/ip_address_space.mojom.h"
#include "services/network/public/mojom/parsed_headers.mojom.h"
#include "url/gurl.h"
namespace network {
namespace {
IPAddressSpace;
IPAddress;
IPEndPoint;
std::optional<IPEndPoint> ParseEndpoint(std::string_view str) { … }
std::optional<IPAddressSpace> ParseIPAddressSpace(std::string_view str) { … }
struct EndpointOverride { … };
std::optional<EndpointOverride> ParseEndpointOverride(std::string_view str) { … }
std::vector<EndpointOverride> ParseEndpointOverrideList(std::string_view list) { … }
std::optional<IPAddressSpace> ApplyCommandLineOverrides(
const IPEndPoint& endpoint) { … }
class AddressSpaceMapEntry { … };
std::optional<IPAddressSpace> AddressSpaceMapEntry::Apply(
const IPAddress& address) const { … }
class AddressSpaceMap { … };
std::optional<IPAddressSpace> AddressSpaceMap::Apply(
const IPAddress& address) const { … }
const AddressSpaceMap& NonPublicAddressSpaceMap() { … }
}
IPAddressSpace IPAddressToIPAddressSpace(const IPAddress& address) { … }
namespace {
IPAddressSpace IPEndPointToIPAddressSpace(const IPEndPoint& endpoint) { … }
}
std::string_view IPAddressSpaceToStringPiece(IPAddressSpace space) { … }
IPAddressSpace TransportInfoToIPAddressSpace(const net::TransportInfo& info) { … }
namespace {
IPAddressSpace CollapseUnknown(IPAddressSpace space) { … }
}
bool IsLessPublicAddressSpace(IPAddressSpace lhs, IPAddressSpace rhs) { … }
CalculateClientAddressSpaceParams::~CalculateClientAddressSpaceParams() =
default;
mojom::IPAddressSpace CalculateClientAddressSpace(
const GURL& url,
std::optional<CalculateClientAddressSpaceParams> params) { … }
mojom::IPAddressSpace CalculateResourceAddressSpace(
const GURL& url,
const net::IPEndPoint& endpoint) { … }
}