| 1 | # ContainerPortMapping |
| 2 | |
| 3 | Represents a published port. |
| 4 | |
| 5 | ```csharp |
| 6 | using Windows.Networking; |
| 7 | |
| 8 | public sealed class ContainerPortMapping |
| 9 | { |
| 10 | public ContainerPortMapping(ushort windowsPort, ushort containerPort, PortProtocol protocol); |
| 11 | |
| 12 | public ushort WindowsPort { get; set; } |
| 13 | public ushort ContainerPort { get; set; } |
| 14 | public PortProtocol Protocol { get; set; } |
| 15 | public HostName WindowsAddress { get; set; } |
| 16 | } |
| 17 | ``` |
| 18 | |
| 19 | Notes: |
| 20 | |
| 21 | - `WindowsAddress` **is implemented**. |
| 22 | - It accepts only `HostNameType.Ipv4` and `HostNameType.Ipv6` values. |
| 23 | - DNS names are rejected. |
| 24 | - `null` means the default host bind address. |
| 25 | |
| 26 | Example: |
| 27 | |
| 28 | ```csharp |
| 29 | using Windows.Networking; |
| 30 | |
| 31 | var mapping = new ContainerPortMapping(8080, 80, PortProtocol.TCP) |
| 32 | { |
| 33 | WindowsAddress = new HostName("127.0.0.1") |
| 34 | }; |
| 35 | ``` |