File: options_linux.go

package info (click to toggle)
docker.io 27.5.1%2Bdfsg4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 67,384 kB
  • sloc: sh: 5,847; makefile: 1,146; ansic: 664; python: 162; asm: 133
file content (91 lines) | stat: -rw-r--r-- 2,076 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package osl

import "net"

func (nh *neigh) processNeighOptions(options ...NeighOption) {
	for _, opt := range options {
		if opt != nil {
			opt(nh)
		}
	}
}

// WithLinkName sets the srcName of the link to use in the neighbor entry.
func WithLinkName(name string) NeighOption {
	return func(nh *neigh) {
		nh.linkName = name
	}
}

// WithFamily sets the address-family for the neighbor entry. e.g. [syscall.AF_BRIDGE].
func WithFamily(family int) NeighOption {
	return func(nh *neigh) {
		nh.family = family
	}
}

// WithIsBridge sets whether the interface is a bridge.
func WithIsBridge(isBridge bool) IfaceOption {
	return func(i *Interface) error {
		i.bridge = isBridge
		return nil
	}
}

// WithMaster sets the master interface (if any) for this interface. The
// master interface name should refer to the srcName of a previously added
// interface of type bridge.
func WithMaster(name string) IfaceOption {
	return func(i *Interface) error {
		i.master = name
		return nil
	}
}

// WithMACAddress sets the interface MAC-address.
func WithMACAddress(mac net.HardwareAddr) IfaceOption {
	return func(i *Interface) error {
		i.mac = mac
		return nil
	}
}

// WithIPv4Address sets the IPv4 address of the interface.
func WithIPv4Address(addr *net.IPNet) IfaceOption {
	return func(i *Interface) error {
		i.address = addr
		return nil
	}
}

// WithIPv6Address sets the IPv6 address of the interface.
func WithIPv6Address(addr *net.IPNet) IfaceOption {
	return func(i *Interface) error {
		i.addressIPv6 = addr
		return nil
	}
}

// WithLinkLocalAddresses set the link-local IP addresses of the interface.
func WithLinkLocalAddresses(list []*net.IPNet) IfaceOption {
	return func(i *Interface) error {
		i.llAddrs = list
		return nil
	}
}

// WithRoutes sets the interface routes.
func WithRoutes(routes []*net.IPNet) IfaceOption {
	return func(i *Interface) error {
		i.routes = routes
		return nil
	}
}

// WithSysctls sets the interface sysctls.
func WithSysctls(sysctls []string) IfaceOption {
	return func(i *Interface) error {
		i.sysctls = sysctls
		return nil
	}
}