Documentation ¶
Overview ¶
Package ip contains utility functions to wrap around the ip program.
Index ¶
- type AddIPOption
- type LinkState
- type Runner
- func (r *Runner) AddIP(ctx context.Context, iface string, ip net.IP, maskLen int, ops ...AddIPOption) error
- func (r *Runner) AddLink(ctx context.Context, name, t string, extraArgs ...string) error
- func (r *Runner) DeleteLink(ctx context.Context, name string) error
- func (r *Runner) Flags(ctx context.Context, iface string) ([]string, error)
- func (r *Runner) FlushIP(ctx context.Context, iface string) error
- func (r *Runner) IsLinkUp(ctx context.Context, iface string) (bool, error)
- func (r *Runner) LinkWithPrefix(ctx context.Context, prefix string) ([]string, error)
- func (r *Runner) MAC(ctx context.Context, iface string) (net.HardwareAddr, error)
- func (r *Runner) SetBridge(ctx context.Context, dev, br string) error
- func (r *Runner) SetLinkDown(ctx context.Context, iface string) error
- func (r *Runner) SetLinkUp(ctx context.Context, iface string) error
- func (r *Runner) SetMAC(ctx context.Context, iface string, mac net.HardwareAddr) error
- func (r *Runner) State(ctx context.Context, iface string) (LinkState, error)
- func (r *Runner) UnsetBridge(ctx context.Context, dev string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddIPOption ¶
type AddIPOption func(*addIPConfig)
AddIPOption is the option type for Runner.AddIP call.
func AddIPBroadcast ¶
func AddIPBroadcast(broadcastIP net.IP) AddIPOption
AddIPBroadcast returns an AddIPOption setting broadcast IP.
type LinkState ¶
type LinkState string
LinkState is the type for the interface state from ip command.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner contains methods rely on running "ip" command.
func (*Runner) AddIP ¶
func (r *Runner) AddIP(ctx context.Context, iface string, ip net.IP, maskLen int, ops ...AddIPOption) error
AddIP adds IPv4/IPv6 settings to iface.
func (*Runner) DeleteLink ¶
DeleteLink deletes a virtual link.
func (*Runner) LinkWithPrefix ¶
LinkWithPrefix shows the device names that start with prefix.
func (*Runner) SetLinkDown ¶
SetLinkDown brings iface down.
func (*Runner) SetMAC ¶
SetMAC sets MAC address of iface with command "ip link set $iface address $mac.
Click to show internal directories.
Click to hide internal directories.