ccl/internal/pkg/network/network.go

48 lines
2.1 KiB
Go

/*
Package network houses configured default metadata. Items defined for
a `network.Network` struct serve as default values for container network
definitions (based on the network Name).
Copyright © 2022 Joel D. Elkins <joel@elkins.co>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package network
import (
"net"
"gopkg.in/guregu/null.v4"
)
// Network - when defined standalone in the configuration file, houses default
// network metadata for a container. A container.Container struct also contains
// a slice of Networks, which define the particulars. If the container
// configuration omits DNS servers or the IPv6 flag, then the stand alone
// definition values will be applied for the container when it is created.
type Network struct {
Name string `toml:"name"`
DNS []net.IP `toml:"dns,omitempty"`
IPv6 null.Bool `toml:"ipv6,omitempty"`
IPv4Address net.IP `toml:"ipv4_address,omitempty"`
IPv6Address net.IP `toml:"ipv6_address,omitempty"`
IPv4Addresses []net.IP `toml:"ipv4_addresses,omitempty"`
IPv6Addresses []net.IP `toml:"ipv6_addresses,omitempty"`
}