master
h 53 lines 1.08 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 WSLCNetworkMetadata.h
8
9 Abstract:
10
11 Constants and types for WSLC-managed Docker networks.
12
13 --*/
14
15 #pragma once
16
17 namespace wsl::windows::service::wslc {
18
19 // Label key used to identify WSLC-managed Docker networks.
20 constexpr auto WSLCNetworkManagedLabel = "com.microsoft.wsl.network.managed";
21 constexpr auto WSLCBridgeNetworkDriver = "bridge";
22
23 // Reserved Docker network names that cannot be used for custom networks.
24 inline bool IsReservedNetworkName(const std::string& name)
25 {
26 return name == "bridge" || name == "host" || name == "none";
27 }
28
29 struct NetworkIPAMConfig
30 {
31 std::string Subnet;
32 std::string Gateway;
33 std::string IPRange;
34 };
35
36 struct NetworkIPAM
37 {
38 std::string Driver;
39 std::optional<std::vector<NetworkIPAMConfig>> Config;
40 };
41
42 struct NetworkEntry
43 {
44 std::string Id;
45 std::string Driver;
46 std::string Scope;
47 bool Internal{false};
48 std::map<std::string, std::string> Labels;
49 std::map<std::string, std::string> Options;
50 NetworkIPAM IPAM;
51 };
52
53 } // namespace wsl::windows::service::wslc