-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
44 lines (35 loc) · 912 Bytes
/
options.go
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
package macpot
// Option that can change the behaviour of the New() function.
type Option func(*MAC) error
// AsLocal is an Option for New() that sets the generated MAC address to be a
// Locally Administered address.
func AsLocal() Option {
return func(mac *MAC) error {
mac.SetLocal()
return nil
}
}
// AsGlobal is an Option for New() that sets the generated MAC address to be a
// Globally Unique address.
func AsGlobal() Option {
return func(mac *MAC) error {
mac.SetGlobal()
return nil
}
}
// AsUnicast is an Option for New() that sets the generated MAC address to be a
// Unicast address.
func AsUnicast() Option {
return func(mac *MAC) error {
mac.SetUnicast()
return nil
}
}
// AsMulticast is an Option for New() that sets the generated MAC address to be a
// Multicast address.
func AsMulticast() Option {
return func(mac *MAC) error {
mac.SetMulticast()
return nil
}
}