github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/libnetwork/osl/options_linux.go (about) 1 package osl 2 3 import "net" 4 5 func (nh *neigh) processNeighOptions(options ...NeighOption) { 6 for _, opt := range options { 7 if opt != nil { 8 opt(nh) 9 } 10 } 11 } 12 13 func (n *networkNamespace) LinkName(name string) NeighOption { 14 return func(nh *neigh) { 15 nh.linkName = name 16 } 17 } 18 19 func (n *networkNamespace) Family(family int) NeighOption { 20 return func(nh *neigh) { 21 nh.family = family 22 } 23 } 24 25 func (i *nwIface) processInterfaceOptions(options ...IfaceOption) { 26 for _, opt := range options { 27 if opt != nil { 28 opt(i) 29 } 30 } 31 } 32 33 func (n *networkNamespace) Bridge(isBridge bool) IfaceOption { 34 return func(i *nwIface) { 35 i.bridge = isBridge 36 } 37 } 38 39 func (n *networkNamespace) Master(name string) IfaceOption { 40 return func(i *nwIface) { 41 i.master = name 42 } 43 } 44 45 func (n *networkNamespace) MacAddress(mac net.HardwareAddr) IfaceOption { 46 return func(i *nwIface) { 47 i.mac = mac 48 } 49 } 50 51 func (n *networkNamespace) Address(addr *net.IPNet) IfaceOption { 52 return func(i *nwIface) { 53 i.address = addr 54 } 55 } 56 57 func (n *networkNamespace) AddressIPv6(addr *net.IPNet) IfaceOption { 58 return func(i *nwIface) { 59 i.addressIPv6 = addr 60 } 61 } 62 63 func (n *networkNamespace) LinkLocalAddresses(list []*net.IPNet) IfaceOption { 64 return func(i *nwIface) { 65 i.llAddrs = list 66 } 67 } 68 69 func (n *networkNamespace) Routes(routes []*net.IPNet) IfaceOption { 70 return func(i *nwIface) { 71 i.routes = routes 72 } 73 }