mirror of
https://github.com/jsimonetti/rtnetlink.git
synced 2026-03-27 23:11:06 +01:00
rtnetlink: expose Conn.SetOption from underlying netlink.Conn (#123)
Signed-off-by: Matt Layher <mdlayher@gmail.com> Co-authored-by: Jeroen Simonetti <jsimonetti@users.noreply.github.com>
This commit is contained in:
parent
f05e8793e9
commit
5ecc0c63ac
6
conn.go
6
conn.go
@ -27,6 +27,7 @@ type conn interface {
|
||||
Send(m netlink.Message) (netlink.Message, error)
|
||||
Receive() ([]netlink.Message, error)
|
||||
Execute(m netlink.Message) ([]netlink.Message, error)
|
||||
SetOption(option netlink.ConnOption, enable bool) error
|
||||
SetReadDeadline(t time.Time) error
|
||||
}
|
||||
|
||||
@ -62,6 +63,11 @@ func (c *Conn) Close() error {
|
||||
return c.c.Close()
|
||||
}
|
||||
|
||||
// SetOption enables or disables a netlink socket option for the Conn.
|
||||
func (c *Conn) SetOption(option netlink.ConnOption, enable bool) error {
|
||||
return c.c.SetOption(option, enable)
|
||||
}
|
||||
|
||||
// SetReadDeadline sets the read deadline associated with the connection.
|
||||
func (c *Conn) SetReadDeadline(t time.Time) error {
|
||||
return c.c.SetReadDeadline(t)
|
||||
|
||||
@ -211,6 +211,7 @@ func (c *noopConn) Close() error { retur
|
||||
func (c *noopConn) Send(_ netlink.Message) (netlink.Message, error) { return netlink.Message{}, nil }
|
||||
func (c *noopConn) Receive() ([]netlink.Message, error) { return nil, nil }
|
||||
func (c *noopConn) Execute(m netlink.Message) ([]netlink.Message, error) { return nil, nil }
|
||||
func (c *noopConn) SetOption(_ netlink.ConnOption, _ bool) error { return nil }
|
||||
func (c *noopConn) SetReadDeadline(t time.Time) error { return nil }
|
||||
|
||||
func mustMarshal(m encoding.BinaryMarshaler) []byte {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user