github.com/containerd/nerdctl@v1.7.7/pkg/netutil/cni_plugin_windows.go (about)

     1  /*
     2     Copyright The containerd Authors.
     3  
     4     Licensed under the Apache License, Version 2.0 (the "License");
     5     you may not use this file except in compliance with the License.
     6     You may obtain a copy of the License at
     7  
     8         http://www.apache.org/licenses/LICENSE-2.0
     9  
    10     Unless required by applicable law or agreed to in writing, software
    11     distributed under the License is distributed on an "AS IS" BASIS,
    12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     See the License for the specific language governing permissions and
    14     limitations under the License.
    15  */
    16  
    17  package netutil
    18  
    19  type natConfig struct {
    20  	PluginType string                 `json:"type"`
    21  	Master     string                 `json:"master,omitempty"`
    22  	IPAM       map[string]interface{} `json:"ipam"`
    23  }
    24  
    25  func (*natConfig) GetPluginType() string {
    26  	return "nat"
    27  }
    28  
    29  func newNatPlugin(master string) *natConfig {
    30  	return &natConfig{
    31  		PluginType: "nat",
    32  		Master:     master,
    33  	}
    34  }
    35  
    36  // https://github.com/microsoft/windows-container-networking/blob/v0.2.0/cni/cni.go#L55-L63
    37  type windowsIpamConfig struct {
    38  	Type          string      `json:"type"`
    39  	Environment   string      `json:"environment,omitempty"`
    40  	AddrSpace     string      `json:"addressSpace,omitempty"`
    41  	Subnet        string      `json:"subnet,omitempty"`
    42  	Address       string      `json:"ipAddress,omitempty"`
    43  	QueryInterval string      `json:"queryInterval,omitempty"`
    44  	Routes        []IPAMRoute `json:"routes,omitempty"`
    45  }
    46  
    47  func newWindowsIPAMConfig() *windowsIpamConfig {
    48  	return &windowsIpamConfig{}
    49  }