nl-linux 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +5 -0
- data/CHANGELOG.md +6 -0
- data/Rakefile +14 -2
- data/generated/nl/linux/binder.rb +172 -44
- data/generated/nl/linux/conntrack.rb +1293 -370
- data/generated/nl/linux/dev_energymodel.rb +278 -93
- data/generated/nl/linux/devlink.rb +5654 -1954
- data/generated/nl/linux/dpll.rb +1838 -669
- data/generated/nl/linux/drm_ras.rb +234 -72
- data/generated/nl/linux/ethtool.rb +6683 -2885
- data/generated/nl/linux/fou.rb +308 -129
- data/generated/nl/linux/handshake.rb +277 -99
- data/generated/nl/linux/lockd.rb +88 -33
- data/generated/nl/linux/mptcp_pm.rb +639 -186
- data/generated/nl/linux/net_shaper.rb +782 -224
- data/generated/nl/linux/netdev.rb +2105 -631
- data/generated/nl/linux/nfsd.rb +1030 -358
- data/generated/nl/linux/nftables.rb +5041 -1612
- data/generated/nl/linux/nl80211.rb +4531 -871
- data/generated/nl/linux/nlctrl.rb +411 -119
- data/generated/nl/linux/ovpn.rb +1211 -293
- data/generated/nl/linux/ovs_datapath.rb +271 -106
- data/generated/nl/linux/ovs_flow.rb +1819 -354
- data/generated/nl/linux/ovs_packet.rb +257 -82
- data/generated/nl/linux/ovs_vport.rb +334 -132
- data/generated/nl/linux/psp.rb +916 -281
- data/generated/nl/linux/rt_addr.rb +369 -166
- data/generated/nl/linux/rt_link.rb +6708 -1450
- data/generated/nl/linux/rt_neigh.rb +919 -364
- data/generated/nl/linux/rt_route.rb +1034 -448
- data/generated/nl/linux/rt_rule.rb +775 -395
- data/generated/nl/linux/sunrpc_cache.rb +297 -102
- data/generated/nl/linux/tc.rb +9989 -1780
- data/generated/nl/linux/tcp_metrics.rb +327 -105
- data/generated/nl/linux/team.rb +279 -93
- data/generated/nl/linux/wireguard.rb +432 -95
- data/generated/nl/linux.rb +1 -0
- data/lib/nl/linux/nlctrl_resolver.rb +31 -0
- data/lib/nl/linux/version.rb +1 -1
- data/sig/generated/nl/linux/binder.rbs +366 -0
- data/sig/generated/nl/linux/conntrack.rbs +2787 -0
- data/sig/generated/nl/linux/dev_energymodel.rbs +636 -0
- data/sig/generated/nl/linux/devlink.rbs +12496 -0
- data/sig/generated/nl/linux/dpll.rbs +3461 -0
- data/sig/generated/nl/linux/drm_ras.rbs +553 -0
- data/sig/generated/nl/linux/ethtool.rbs +15291 -0
- data/sig/generated/nl/linux/fou.rbs +702 -0
- data/sig/generated/nl/linux/handshake.rbs +622 -0
- data/sig/generated/nl/linux/lockd.rbs +234 -0
- data/sig/generated/nl/linux/mptcp_pm.rbs +1511 -0
- data/sig/generated/nl/linux/net_shaper.rbs +1645 -0
- data/sig/generated/nl/linux/netdev.rbs +4187 -0
- data/sig/generated/nl/linux/nfsd.rbs +2520 -0
- data/sig/generated/nl/linux/nftables.rbs +10304 -0
- data/sig/generated/nl/linux/nl80211.rbs +9786 -0
- data/sig/generated/nl/linux/nlctrl.rbs +944 -0
- data/sig/generated/nl/linux/nlctrl_resolver.rbs +20 -0
- data/sig/generated/nl/linux/ovpn.rbs +2564 -0
- data/sig/generated/nl/linux/ovs_datapath.rbs +640 -0
- data/sig/generated/nl/linux/ovs_flow.rbs +3659 -0
- data/sig/generated/nl/linux/ovs_packet.rbs +540 -0
- data/sig/generated/nl/linux/ovs_vport.rbs +777 -0
- data/sig/generated/nl/linux/psp.rbs +1846 -0
- data/sig/generated/nl/linux/rt_addr.rbs +866 -0
- data/sig/generated/nl/linux/rt_link.rbs +13438 -0
- data/sig/generated/nl/linux/rt_neigh.rbs +2124 -0
- data/sig/generated/nl/linux/rt_route.rbs +2218 -0
- data/sig/generated/nl/linux/rt_rule.rbs +1726 -0
- data/sig/generated/nl/linux/sunrpc_cache.rbs +739 -0
- data/sig/generated/nl/linux/tc.rbs +19931 -0
- data/sig/generated/nl/linux/tcp_metrics.rbs +740 -0
- data/sig/generated/nl/linux/team.rbs +733 -0
- data/sig/generated/nl/linux/version.rbs +7 -0
- data/sig/generated/nl/linux/wireguard.rbs +1006 -0
- data/sig/generated/nl/linux.rbs +6 -0
- data/sig/generated/nl-linux.rbs +2 -0
- metadata +46 -7
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# This file is based on Documentation/netlink/specs/wireguard.yaml from Linux v7.2.
|
|
4
4
|
#--
|
|
5
5
|
# frozen_string_literal: true
|
|
6
|
-
# rbs_inline: enabled
|
|
7
6
|
# This code is generated by Ynl::Generator. DO NOT EDIT.
|
|
8
7
|
require 'nl'
|
|
9
8
|
module Nl; module Linux
|
|
@@ -15,208 +14,477 @@ module Nl; module Linux
|
|
|
15
14
|
# attributes, these two commands actually accept a slightly different set of
|
|
16
15
|
# inputs and outputs. These differences are noted under the individual
|
|
17
16
|
# attributes.
|
|
18
|
-
class Wireguard < ::Nl::Family
|
|
17
|
+
class Wireguard < ::Nl::Genl::Family
|
|
19
18
|
NAME = "wireguard"
|
|
20
|
-
|
|
19
|
+
VERSION = 1
|
|
20
|
+
# @rbs (?resolver: ^(::Nl::Genl::Client, ::String) -> ::Nl::Genl::FamilyInfo, ?executor: executor?, ?notification_capacity: ::Integer?) -> (::Nl::Family::Session & instance)
|
|
21
|
+
# @rbs | [R] (?resolver: ^(::Nl::Genl::Client, ::String) -> ::Nl::Genl::FamilyInfo, ?executor: executor?, ?notification_capacity: ::Integer?) { (instance) -> R } -> R
|
|
22
|
+
# @overload open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY)
|
|
23
|
+
# @param [#call] resolver
|
|
24
|
+
# @param [Symbol, nil] executor
|
|
25
|
+
# @param [Integer, nil] notification_capacity
|
|
26
|
+
# @return [Wireguard]
|
|
27
|
+
# @overload open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY, &block)
|
|
28
|
+
# @param [#call] resolver
|
|
29
|
+
# @param [Symbol, nil] executor
|
|
30
|
+
# @param [Integer, nil] notification_capacity
|
|
31
|
+
# @yieldparam [Wireguard] family
|
|
32
|
+
# @return [Object] the result of the block
|
|
33
|
+
def self.open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY)
|
|
34
|
+
super
|
|
35
|
+
end
|
|
36
|
+
# @private
|
|
21
37
|
MCAST_GROUPS = Ractor.make_shareable({}) #: Hash[::Symbol, ::Nl::McastGroup]
|
|
38
|
+
module Constants
|
|
39
|
+
WG_KEY_LEN = 32
|
|
40
|
+
end
|
|
41
|
+
module Flags
|
|
42
|
+
module WgdeviceFlags
|
|
43
|
+
ReplacePeers = 1
|
|
44
|
+
end
|
|
45
|
+
module WgpeerFlags
|
|
46
|
+
RemoveMe = 1
|
|
47
|
+
ReplaceAllowedips = 2
|
|
48
|
+
UpdateOnly = 4
|
|
49
|
+
end
|
|
50
|
+
module WgallowedipFlags
|
|
51
|
+
RemoveMe = 1
|
|
52
|
+
end
|
|
53
|
+
end
|
|
22
54
|
module Structs
|
|
23
55
|
KernelTimespec = Struct.new(
|
|
24
56
|
:"sec", #: ::Integer
|
|
25
57
|
:"nsec", #: ::Integer
|
|
26
58
|
)
|
|
27
59
|
class KernelTimespec
|
|
28
|
-
#
|
|
29
|
-
|
|
60
|
+
# @!attribute [rw] sec
|
|
61
|
+
# Number of seconds, since UNIX epoch.
|
|
62
|
+
# @return [Integer]
|
|
63
|
+
# @!attribute [rw] nsec
|
|
64
|
+
# Number of nanoseconds, after the second began.
|
|
65
|
+
# @return [Integer]
|
|
66
|
+
# @private
|
|
67
|
+
MEMBERS = Ractor.make_shareable({sec: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil), nsec: ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)}) #: Hash[::Symbol, ::Nl::_DataType]
|
|
30
68
|
# Decodes the struct.
|
|
31
|
-
#--
|
|
32
69
|
# @rbs decoder: ::Nl::Decoder
|
|
33
70
|
# @rbs return: instance
|
|
71
|
+
# @param [Nl::Decoder] decoder
|
|
72
|
+
# @return [self]
|
|
34
73
|
def self.decode(decoder)
|
|
35
74
|
self.new(*MEMBERS.map {|name, datatype| datatype.decode(decoder) })
|
|
36
75
|
end
|
|
37
76
|
# Encodes the struct.
|
|
38
|
-
#--
|
|
39
77
|
# @rbs encoder: ::Nl::Encoder
|
|
40
78
|
# @rbs return: void
|
|
79
|
+
# @param [Nl::Encoder] encoder
|
|
80
|
+
# @return [void]
|
|
41
81
|
def encode(encoder)
|
|
42
82
|
MEMBERS.each {|name, datatype| datatype.encode(encoder, self.public_send(name)) }
|
|
43
83
|
end
|
|
44
84
|
end
|
|
45
85
|
end
|
|
46
86
|
module AttributeSets
|
|
47
|
-
class Wgdevice < ::Nl::
|
|
87
|
+
class Wgdevice < ::Nl::AttributeSet
|
|
48
88
|
# Abstract class
|
|
49
|
-
class Attribute < ::Nl::
|
|
89
|
+
class Attribute < ::Nl::AttributeSet::Attribute
|
|
50
90
|
end
|
|
51
91
|
class Ifindex < Attribute
|
|
52
92
|
TYPE = 1
|
|
53
93
|
NAME = :"ifindex"
|
|
54
|
-
|
|
94
|
+
# @private
|
|
95
|
+
ORDER = 0
|
|
96
|
+
# @private
|
|
97
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
|
|
55
98
|
end
|
|
56
99
|
class Ifname < Attribute
|
|
57
100
|
TYPE = 2
|
|
58
101
|
NAME = :"ifname"
|
|
59
|
-
|
|
102
|
+
# @private
|
|
103
|
+
ORDER = 1
|
|
104
|
+
# @private
|
|
105
|
+
DATATYPE = ::Nl::DataTypes::String.new(check: -> { raise ArgumentError, "Value #{it.inspect} is longer than maximum length 15" unless it.bytesize <= 15 })
|
|
60
106
|
end
|
|
107
|
+
# Set to all zeros to remove.
|
|
61
108
|
class PrivateKey < Attribute
|
|
62
109
|
TYPE = 3
|
|
63
110
|
NAME = :"private_key"
|
|
64
|
-
|
|
111
|
+
# @private
|
|
112
|
+
ORDER = 2
|
|
113
|
+
# @private
|
|
114
|
+
DATATYPE = ::Nl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length #{Constants::WG_KEY_LEN}" unless it.bytesize == Constants::WG_KEY_LEN })
|
|
65
115
|
end
|
|
66
116
|
class PublicKey < Attribute
|
|
67
117
|
TYPE = 4
|
|
68
118
|
NAME = :"public_key"
|
|
69
|
-
|
|
119
|
+
# @private
|
|
120
|
+
ORDER = 3
|
|
121
|
+
# @private
|
|
122
|
+
DATATYPE = ::Nl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length #{Constants::WG_KEY_LEN}" unless it.bytesize == Constants::WG_KEY_LEN })
|
|
70
123
|
end
|
|
124
|
+
# ``0`` or ``WGDEVICE_F_REPLACE_PEERS`` if all current peers should be
|
|
125
|
+
# removed prior to adding the list below.
|
|
126
|
+
#
|
|
127
|
+
#
|
|
128
|
+
# Known flags are defined in {Flags::WgdeviceFlags}.
|
|
71
129
|
class Flags < Attribute
|
|
72
130
|
TYPE = 5
|
|
73
131
|
NAME = :"flags"
|
|
74
|
-
|
|
132
|
+
# @private
|
|
133
|
+
ORDER = 4
|
|
134
|
+
# @private
|
|
135
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
|
|
75
136
|
end
|
|
137
|
+
# Set as ``0`` to choose randomly.
|
|
76
138
|
class ListenPort < Attribute
|
|
77
139
|
TYPE = 6
|
|
78
140
|
NAME = :"listen_port"
|
|
79
|
-
|
|
141
|
+
# @private
|
|
142
|
+
ORDER = 5
|
|
143
|
+
# @private
|
|
144
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
|
|
80
145
|
end
|
|
146
|
+
# Set as ``0`` to disable.
|
|
81
147
|
class Fwmark < Attribute
|
|
82
148
|
TYPE = 7
|
|
83
149
|
NAME = :"fwmark"
|
|
84
|
-
|
|
150
|
+
# @private
|
|
151
|
+
ORDER = 6
|
|
152
|
+
# @private
|
|
153
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
|
|
85
154
|
end
|
|
155
|
+
# The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
156
|
+
# zero on ``GET_DEVICE`` operations.
|
|
86
157
|
class Peers < Attribute
|
|
87
158
|
TYPE = 8
|
|
88
159
|
NAME = :"peers"
|
|
160
|
+
# @private
|
|
161
|
+
ORDER = 7
|
|
89
162
|
end
|
|
90
|
-
#
|
|
163
|
+
# @private
|
|
91
164
|
BY_NAME = Ractor.make_shareable({:"ifindex" => Ifindex, :"ifname" => Ifname, :"private_key" => PrivateKey, :"public_key" => PublicKey, :"flags" => Flags, :"listen_port" => ListenPort, :"fwmark" => Fwmark, :"peers" => Peers}) #: Hash[::Symbol, Attribute]
|
|
92
|
-
#
|
|
165
|
+
# @private
|
|
93
166
|
BY_TYPE = Ractor.make_shareable({1 => Ifindex, 2 => Ifname, 3 => PrivateKey, 4 => PublicKey, 5 => Flags, 6 => ListenPort, 7 => Fwmark, 8 => Peers}) #: Hash[::Integer, Attribute]
|
|
167
|
+
# @rbs return: ::Integer
|
|
168
|
+
# @return [Integer]
|
|
169
|
+
# @see Ifindex
|
|
170
|
+
def ifindex; self[:"ifindex"]&.value; end
|
|
171
|
+
# @rbs return: ::String
|
|
172
|
+
# @return [String]
|
|
173
|
+
# @see Ifname
|
|
174
|
+
def ifname; self[:"ifname"]&.value; end
|
|
175
|
+
# Set to all zeros to remove.
|
|
176
|
+
# @rbs return: ::String
|
|
177
|
+
# @return [String]
|
|
178
|
+
# @see PrivateKey
|
|
179
|
+
def private_key; self[:"private_key"]&.value; end
|
|
180
|
+
# @rbs return: ::String
|
|
181
|
+
# @return [String]
|
|
182
|
+
# @see PublicKey
|
|
183
|
+
def public_key; self[:"public_key"]&.value; end
|
|
184
|
+
# ``0`` or ``WGDEVICE_F_REPLACE_PEERS`` if all current peers should be
|
|
185
|
+
# removed prior to adding the list below.
|
|
186
|
+
#
|
|
187
|
+
#
|
|
188
|
+
# Known flags are defined in {Flags::WgdeviceFlags}.
|
|
189
|
+
# @rbs return: ::Integer
|
|
190
|
+
# @return [Integer]
|
|
191
|
+
# @see Flags
|
|
192
|
+
def flags; self[:"flags"]&.value; end
|
|
193
|
+
# Set as ``0`` to choose randomly.
|
|
194
|
+
# @rbs return: ::Integer
|
|
195
|
+
# @return [Integer]
|
|
196
|
+
# @see ListenPort
|
|
197
|
+
def listen_port; self[:"listen_port"]&.value; end
|
|
198
|
+
# Set as ``0`` to disable.
|
|
199
|
+
# @rbs return: ::Integer
|
|
200
|
+
# @return [Integer]
|
|
201
|
+
# @see Fwmark
|
|
202
|
+
def fwmark; self[:"fwmark"]&.value; end
|
|
203
|
+
# The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
204
|
+
# zero on ``GET_DEVICE`` operations.
|
|
205
|
+
# @rbs return: ::Array[AttributeSets::Wgpeer]
|
|
206
|
+
# @return [Array<AttributeSets::Wgpeer>]
|
|
207
|
+
# @see Peers
|
|
208
|
+
def peers; self[:"peers"]&.value; end
|
|
94
209
|
class << self
|
|
95
210
|
# Looks up Attribute class by name.
|
|
96
|
-
#--
|
|
97
211
|
# @rbs name: Symbol
|
|
98
212
|
# @rbs return: Attribute
|
|
213
|
+
# @param [Symbol] name
|
|
214
|
+
# @return [Attribute]
|
|
99
215
|
def by_name(name); BY_NAME.fetch(name); end
|
|
100
216
|
# Looks up Attribute class by type value.
|
|
101
|
-
#--
|
|
102
217
|
# @rbs type: Integer
|
|
103
218
|
# @rbs return: Attribute
|
|
219
|
+
# @param [Integer] type
|
|
220
|
+
# @return [Attribute]
|
|
104
221
|
def by_type(type); BY_TYPE.fetch(type); end
|
|
105
222
|
end
|
|
106
223
|
end
|
|
107
|
-
class Wgpeer < ::Nl::
|
|
224
|
+
class Wgpeer < ::Nl::AttributeSet
|
|
108
225
|
# Abstract class
|
|
109
|
-
class Attribute < ::Nl::
|
|
226
|
+
class Attribute < ::Nl::AttributeSet::Attribute
|
|
110
227
|
end
|
|
111
228
|
class PublicKey < Attribute
|
|
112
229
|
TYPE = 1
|
|
113
230
|
NAME = :"public_key"
|
|
114
|
-
|
|
231
|
+
# @private
|
|
232
|
+
ORDER = 0
|
|
233
|
+
# @private
|
|
234
|
+
DATATYPE = ::Nl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length #{Constants::WG_KEY_LEN}" unless it.bytesize == Constants::WG_KEY_LEN })
|
|
115
235
|
end
|
|
236
|
+
# Set as all zeros to remove.
|
|
116
237
|
class PresharedKey < Attribute
|
|
117
238
|
TYPE = 2
|
|
118
239
|
NAME = :"preshared_key"
|
|
119
|
-
|
|
240
|
+
# @private
|
|
241
|
+
ORDER = 1
|
|
242
|
+
# @private
|
|
243
|
+
DATATYPE = ::Nl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length #{Constants::WG_KEY_LEN}" unless it.bytesize == Constants::WG_KEY_LEN })
|
|
120
244
|
end
|
|
245
|
+
# ``0`` and/or ``WGPEER_F_REMOVE_ME`` if the specified peer should not
|
|
246
|
+
# exist at the end of the operation, rather than added/updated and/or
|
|
247
|
+
# ``WGPEER_F_REPLACE_ALLOWEDIPS`` if all current allowed IPs of this
|
|
248
|
+
# peer should be removed prior to adding the list below and/or
|
|
249
|
+
# ``WGPEER_F_UPDATE_ONLY`` if the peer should only be set if it already
|
|
250
|
+
# exists.
|
|
251
|
+
#
|
|
252
|
+
#
|
|
253
|
+
# Known flags are defined in {Flags::WgpeerFlags}.
|
|
121
254
|
class Flags < Attribute
|
|
122
255
|
TYPE = 3
|
|
123
256
|
NAME = :"flags"
|
|
124
|
-
|
|
257
|
+
# @private
|
|
258
|
+
ORDER = 2
|
|
259
|
+
# @private
|
|
260
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
|
|
125
261
|
end
|
|
262
|
+
# struct sockaddr_in or struct sockaddr_in6
|
|
126
263
|
class Endpoint < Attribute
|
|
127
264
|
TYPE = 4
|
|
128
265
|
NAME = :"endpoint"
|
|
129
|
-
|
|
266
|
+
# @private
|
|
267
|
+
ORDER = 3
|
|
268
|
+
# @private
|
|
269
|
+
DATATYPE = ::Nl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is shorter than minimum length 16" unless it.bytesize >= 16 })
|
|
130
270
|
end
|
|
271
|
+
# Set as ``0`` to disable.
|
|
131
272
|
class PersistentKeepaliveInterval < Attribute
|
|
132
273
|
TYPE = 5
|
|
133
274
|
NAME = :"persistent_keepalive_interval"
|
|
134
|
-
|
|
275
|
+
# @private
|
|
276
|
+
ORDER = 4
|
|
277
|
+
# @private
|
|
278
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
|
|
135
279
|
end
|
|
136
280
|
class LastHandshakeTime < Attribute
|
|
137
281
|
TYPE = 6
|
|
138
282
|
NAME = :"last_handshake_time"
|
|
139
|
-
|
|
283
|
+
# @private
|
|
284
|
+
ORDER = 5
|
|
285
|
+
# @private
|
|
286
|
+
DATATYPE = ::Nl::DataTypes::Struct.new(Structs::KernelTimespec, check: -> { raise ArgumentError, "Value #{it.inspect} is not equal to length 16" unless it.bytesize == 16 }, consume_remaining: true)
|
|
140
287
|
end
|
|
141
288
|
class RxBytes < Attribute
|
|
142
289
|
TYPE = 7
|
|
143
290
|
NAME = :"rx_bytes"
|
|
144
|
-
|
|
291
|
+
# @private
|
|
292
|
+
ORDER = 6
|
|
293
|
+
# @private
|
|
294
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
|
|
145
295
|
end
|
|
146
296
|
class TxBytes < Attribute
|
|
147
297
|
TYPE = 8
|
|
148
298
|
NAME = :"tx_bytes"
|
|
149
|
-
|
|
299
|
+
# @private
|
|
300
|
+
ORDER = 7
|
|
301
|
+
# @private
|
|
302
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U64, check: nil)
|
|
150
303
|
end
|
|
304
|
+
# The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
305
|
+
# zero on ``GET_DEVICE`` operations.
|
|
151
306
|
class Allowedips < Attribute
|
|
152
307
|
TYPE = 9
|
|
153
308
|
NAME = :"allowedips"
|
|
309
|
+
# @private
|
|
310
|
+
ORDER = 8
|
|
154
311
|
end
|
|
312
|
+
# Should not be set or used at all by most users of this API, as the
|
|
313
|
+
# most recent protocol will be used when this is unset. Otherwise,
|
|
314
|
+
# must be set to ``1``.
|
|
155
315
|
class ProtocolVersion < Attribute
|
|
156
316
|
TYPE = 10
|
|
157
317
|
NAME = :"protocol_version"
|
|
158
|
-
|
|
318
|
+
# @private
|
|
319
|
+
ORDER = 9
|
|
320
|
+
# @private
|
|
321
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
|
|
159
322
|
end
|
|
160
|
-
#
|
|
323
|
+
# @private
|
|
161
324
|
BY_NAME = Ractor.make_shareable({:"public_key" => PublicKey, :"preshared_key" => PresharedKey, :"flags" => Flags, :"endpoint" => Endpoint, :"persistent_keepalive_interval" => PersistentKeepaliveInterval, :"last_handshake_time" => LastHandshakeTime, :"rx_bytes" => RxBytes, :"tx_bytes" => TxBytes, :"allowedips" => Allowedips, :"protocol_version" => ProtocolVersion}) #: Hash[::Symbol, Attribute]
|
|
162
|
-
#
|
|
325
|
+
# @private
|
|
163
326
|
BY_TYPE = Ractor.make_shareable({1 => PublicKey, 2 => PresharedKey, 3 => Flags, 4 => Endpoint, 5 => PersistentKeepaliveInterval, 6 => LastHandshakeTime, 7 => RxBytes, 8 => TxBytes, 9 => Allowedips, 10 => ProtocolVersion}) #: Hash[::Integer, Attribute]
|
|
327
|
+
# @rbs return: ::String
|
|
328
|
+
# @return [String]
|
|
329
|
+
# @see PublicKey
|
|
330
|
+
def public_key; self[:"public_key"]&.value; end
|
|
331
|
+
# Set as all zeros to remove.
|
|
332
|
+
# @rbs return: ::String
|
|
333
|
+
# @return [String]
|
|
334
|
+
# @see PresharedKey
|
|
335
|
+
def preshared_key; self[:"preshared_key"]&.value; end
|
|
336
|
+
# ``0`` and/or ``WGPEER_F_REMOVE_ME`` if the specified peer should not
|
|
337
|
+
# exist at the end of the operation, rather than added/updated and/or
|
|
338
|
+
# ``WGPEER_F_REPLACE_ALLOWEDIPS`` if all current allowed IPs of this
|
|
339
|
+
# peer should be removed prior to adding the list below and/or
|
|
340
|
+
# ``WGPEER_F_UPDATE_ONLY`` if the peer should only be set if it already
|
|
341
|
+
# exists.
|
|
342
|
+
#
|
|
343
|
+
#
|
|
344
|
+
# Known flags are defined in {Flags::WgpeerFlags}.
|
|
345
|
+
# @rbs return: ::Integer
|
|
346
|
+
# @return [Integer]
|
|
347
|
+
# @see Flags
|
|
348
|
+
def flags; self[:"flags"]&.value; end
|
|
349
|
+
# struct sockaddr_in or struct sockaddr_in6
|
|
350
|
+
# @rbs return: ::String
|
|
351
|
+
# @return [String]
|
|
352
|
+
# @see Endpoint
|
|
353
|
+
def endpoint; self[:"endpoint"]&.value; end
|
|
354
|
+
# Set as ``0`` to disable.
|
|
355
|
+
# @rbs return: ::Integer
|
|
356
|
+
# @return [Integer]
|
|
357
|
+
# @see PersistentKeepaliveInterval
|
|
358
|
+
def persistent_keepalive_interval; self[:"persistent_keepalive_interval"]&.value; end
|
|
359
|
+
# @rbs return: Structs::KernelTimespec
|
|
360
|
+
# @return [Structs::KernelTimespec]
|
|
361
|
+
# @see LastHandshakeTime
|
|
362
|
+
def last_handshake_time; self[:"last_handshake_time"]&.value; end
|
|
363
|
+
# @rbs return: ::Integer
|
|
364
|
+
# @return [Integer]
|
|
365
|
+
# @see RxBytes
|
|
366
|
+
def rx_bytes; self[:"rx_bytes"]&.value; end
|
|
367
|
+
# @rbs return: ::Integer
|
|
368
|
+
# @return [Integer]
|
|
369
|
+
# @see TxBytes
|
|
370
|
+
def tx_bytes; self[:"tx_bytes"]&.value; end
|
|
371
|
+
# The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
372
|
+
# zero on ``GET_DEVICE`` operations.
|
|
373
|
+
# @rbs return: ::Array[AttributeSets::Wgallowedip]
|
|
374
|
+
# @return [Array<AttributeSets::Wgallowedip>]
|
|
375
|
+
# @see Allowedips
|
|
376
|
+
def allowedips; self[:"allowedips"]&.value; end
|
|
377
|
+
# Should not be set or used at all by most users of this API, as the
|
|
378
|
+
# most recent protocol will be used when this is unset. Otherwise,
|
|
379
|
+
# must be set to ``1``.
|
|
380
|
+
# @rbs return: ::Integer
|
|
381
|
+
# @return [Integer]
|
|
382
|
+
# @see ProtocolVersion
|
|
383
|
+
def protocol_version; self[:"protocol_version"]&.value; end
|
|
164
384
|
class << self
|
|
165
385
|
# Looks up Attribute class by name.
|
|
166
|
-
#--
|
|
167
386
|
# @rbs name: Symbol
|
|
168
387
|
# @rbs return: Attribute
|
|
388
|
+
# @param [Symbol] name
|
|
389
|
+
# @return [Attribute]
|
|
169
390
|
def by_name(name); BY_NAME.fetch(name); end
|
|
170
391
|
# Looks up Attribute class by type value.
|
|
171
|
-
#--
|
|
172
392
|
# @rbs type: Integer
|
|
173
393
|
# @rbs return: Attribute
|
|
394
|
+
# @param [Integer] type
|
|
395
|
+
# @return [Attribute]
|
|
174
396
|
def by_type(type); BY_TYPE.fetch(type); end
|
|
175
397
|
end
|
|
176
398
|
end
|
|
177
|
-
class Wgallowedip < ::Nl::
|
|
399
|
+
class Wgallowedip < ::Nl::AttributeSet
|
|
178
400
|
# Abstract class
|
|
179
|
-
class Attribute < ::Nl::
|
|
401
|
+
class Attribute < ::Nl::AttributeSet::Attribute
|
|
180
402
|
end
|
|
403
|
+
# IP family, either ``AF_INET`` or ``AF_INET6``.
|
|
181
404
|
class Family < Attribute
|
|
182
405
|
TYPE = 1
|
|
183
406
|
NAME = :"family"
|
|
184
|
-
|
|
407
|
+
# @private
|
|
408
|
+
ORDER = 0
|
|
409
|
+
# @private
|
|
410
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U16, check: nil)
|
|
185
411
|
end
|
|
412
|
+
# Either ``struct in_addr`` or ``struct in6_addr``.
|
|
186
413
|
class Ipaddr < Attribute
|
|
187
414
|
TYPE = 2
|
|
188
415
|
NAME = :"ipaddr"
|
|
189
|
-
|
|
416
|
+
# @private
|
|
417
|
+
ORDER = 1
|
|
418
|
+
# @private
|
|
419
|
+
DATATYPE = ::Nl::DataTypes::Binary.new(check: -> { raise ArgumentError, "Value #{it.inspect} is shorter than minimum length 4" unless it.bytesize >= 4 })
|
|
190
420
|
end
|
|
191
421
|
class CidrMask < Attribute
|
|
192
422
|
TYPE = 3
|
|
193
423
|
NAME = :"cidr_mask"
|
|
194
|
-
|
|
424
|
+
# @private
|
|
425
|
+
ORDER = 2
|
|
426
|
+
# @private
|
|
427
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U8, check: nil)
|
|
195
428
|
end
|
|
429
|
+
# ``WGALLOWEDIP_F_REMOVE_ME`` if the specified IP should be removed;
|
|
430
|
+
# otherwise, this IP will be added if it is not already present.
|
|
431
|
+
#
|
|
432
|
+
#
|
|
433
|
+
# Known flags are defined in {Flags::WgallowedipFlags}.
|
|
196
434
|
class Flags < Attribute
|
|
197
435
|
TYPE = 4
|
|
198
436
|
NAME = :"flags"
|
|
199
|
-
|
|
437
|
+
# @private
|
|
438
|
+
ORDER = 3
|
|
439
|
+
# @private
|
|
440
|
+
DATATYPE = ::Nl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
|
|
200
441
|
end
|
|
201
|
-
#
|
|
442
|
+
# @private
|
|
202
443
|
BY_NAME = Ractor.make_shareable({:"family" => Family, :"ipaddr" => Ipaddr, :"cidr_mask" => CidrMask, :"flags" => Flags}) #: Hash[::Symbol, Attribute]
|
|
203
|
-
#
|
|
444
|
+
# @private
|
|
204
445
|
BY_TYPE = Ractor.make_shareable({1 => Family, 2 => Ipaddr, 3 => CidrMask, 4 => Flags}) #: Hash[::Integer, Attribute]
|
|
446
|
+
# IP family, either ``AF_INET`` or ``AF_INET6``.
|
|
447
|
+
# @rbs return: ::Integer
|
|
448
|
+
# @return [Integer]
|
|
449
|
+
# @see Family
|
|
450
|
+
def family; self[:"family"]&.value; end
|
|
451
|
+
# Either ``struct in_addr`` or ``struct in6_addr``.
|
|
452
|
+
# @rbs return: ::String
|
|
453
|
+
# @return [String]
|
|
454
|
+
# @see Ipaddr
|
|
455
|
+
def ipaddr; self[:"ipaddr"]&.value; end
|
|
456
|
+
# @rbs return: ::Integer
|
|
457
|
+
# @return [Integer]
|
|
458
|
+
# @see CidrMask
|
|
459
|
+
def cidr_mask; self[:"cidr_mask"]&.value; end
|
|
460
|
+
# ``WGALLOWEDIP_F_REMOVE_ME`` if the specified IP should be removed;
|
|
461
|
+
# otherwise, this IP will be added if it is not already present.
|
|
462
|
+
#
|
|
463
|
+
#
|
|
464
|
+
# Known flags are defined in {Flags::WgallowedipFlags}.
|
|
465
|
+
# @rbs return: ::Integer
|
|
466
|
+
# @return [Integer]
|
|
467
|
+
# @see Flags
|
|
468
|
+
def flags; self[:"flags"]&.value; end
|
|
205
469
|
class << self
|
|
206
470
|
# Looks up Attribute class by name.
|
|
207
|
-
#--
|
|
208
471
|
# @rbs name: Symbol
|
|
209
472
|
# @rbs return: Attribute
|
|
473
|
+
# @param [Symbol] name
|
|
474
|
+
# @return [Attribute]
|
|
210
475
|
def by_name(name); BY_NAME.fetch(name); end
|
|
211
476
|
# Looks up Attribute class by type value.
|
|
212
|
-
#--
|
|
213
477
|
# @rbs type: Integer
|
|
214
478
|
# @rbs return: Attribute
|
|
479
|
+
# @param [Integer] type
|
|
480
|
+
# @return [Attribute]
|
|
215
481
|
def by_type(type); BY_TYPE.fetch(type); end
|
|
216
482
|
end
|
|
217
483
|
end
|
|
218
|
-
|
|
219
|
-
|
|
484
|
+
# @private
|
|
485
|
+
Wgdevice::Peers::DATATYPE = ::Nl::DataTypes::IndexedArray.new(::Nl::DataTypes::NestedAttributes.new(AttributeSets::Wgpeer, selector_bindings: Ractor.make_shareable([])))
|
|
486
|
+
# @private
|
|
487
|
+
Wgpeer::Allowedips::DATATYPE = ::Nl::DataTypes::IndexedArray.new(::Nl::DataTypes::NestedAttributes.new(AttributeSets::Wgallowedip, selector_bindings: Ractor.make_shareable([])))
|
|
220
488
|
end
|
|
221
489
|
module Messages
|
|
222
490
|
# Retrieve WireGuard device
|
|
@@ -246,18 +514,18 @@ class Wireguard < ::Nl::Family
|
|
|
246
514
|
#
|
|
247
515
|
#
|
|
248
516
|
# Requires CAP_NET_ADMIN in the user namespace owning the network namespace.
|
|
249
|
-
class DumpGetDeviceRequest < ::Nl::
|
|
517
|
+
class DumpGetDeviceRequest < ::Nl::Genl::Message
|
|
250
518
|
TYPE = 0
|
|
251
519
|
FIXED_HEADER = nil
|
|
252
520
|
ATTRIBUTE_SET = AttributeSets::Wgdevice
|
|
253
521
|
ATTRIBUTES = Ractor.make_shareable(%i[ifindex ifname])
|
|
254
|
-
# Gets the value of `ifindex` attribute in the message.
|
|
255
|
-
#--
|
|
256
522
|
# @rbs return: ::Integer
|
|
523
|
+
# @return [Integer]
|
|
524
|
+
# @see AttributeSets::Wgdevice::Ifindex
|
|
257
525
|
def ifindex; attributes[:"ifindex"]&.value; end
|
|
258
|
-
# Gets the value of `ifname` attribute in the message.
|
|
259
|
-
#--
|
|
260
526
|
# @rbs return: ::String
|
|
527
|
+
# @return [String]
|
|
528
|
+
# @see AttributeSets::Wgdevice::Ifname
|
|
261
529
|
def ifname; attributes[:"ifname"]&.value; end
|
|
262
530
|
end
|
|
263
531
|
# Retrieve WireGuard device
|
|
@@ -287,42 +555,52 @@ class Wireguard < ::Nl::Family
|
|
|
287
555
|
#
|
|
288
556
|
#
|
|
289
557
|
# Requires CAP_NET_ADMIN in the user namespace owning the network namespace.
|
|
290
|
-
class DumpGetDeviceReply < ::Nl::
|
|
558
|
+
class DumpGetDeviceReply < ::Nl::Genl::Message
|
|
291
559
|
TYPE = 0
|
|
292
560
|
FIXED_HEADER = nil
|
|
293
561
|
ATTRIBUTE_SET = AttributeSets::Wgdevice
|
|
294
562
|
ATTRIBUTES = Ractor.make_shareable(%i[ifindex ifname private_key public_key flags listen_port fwmark peers])
|
|
295
|
-
# Gets the value of `ifindex` attribute in the message.
|
|
296
|
-
#--
|
|
297
563
|
# @rbs return: ::Integer
|
|
564
|
+
# @return [Integer]
|
|
565
|
+
# @see AttributeSets::Wgdevice::Ifindex
|
|
298
566
|
def ifindex; attributes[:"ifindex"]&.value; end
|
|
299
|
-
# Gets the value of `ifname` attribute in the message.
|
|
300
|
-
#--
|
|
301
567
|
# @rbs return: ::String
|
|
568
|
+
# @return [String]
|
|
569
|
+
# @see AttributeSets::Wgdevice::Ifname
|
|
302
570
|
def ifname; attributes[:"ifname"]&.value; end
|
|
303
|
-
#
|
|
304
|
-
#--
|
|
571
|
+
# Set to all zeros to remove.
|
|
305
572
|
# @rbs return: ::String
|
|
573
|
+
# @return [String]
|
|
574
|
+
# @see AttributeSets::Wgdevice::PrivateKey
|
|
306
575
|
def private_key; attributes[:"private_key"]&.value; end
|
|
307
|
-
# Gets the value of `public-key` attribute in the message.
|
|
308
|
-
#--
|
|
309
576
|
# @rbs return: ::String
|
|
577
|
+
# @return [String]
|
|
578
|
+
# @see AttributeSets::Wgdevice::PublicKey
|
|
310
579
|
def public_key; attributes[:"public_key"]&.value; end
|
|
311
|
-
#
|
|
312
|
-
|
|
580
|
+
# ``0`` or ``WGDEVICE_F_REPLACE_PEERS`` if all current peers should be
|
|
581
|
+
# removed prior to adding the list below.
|
|
582
|
+
#
|
|
583
|
+
#
|
|
584
|
+
# Known flags are defined in {Flags::WgdeviceFlags}.
|
|
313
585
|
# @rbs return: ::Integer
|
|
586
|
+
# @return [Integer]
|
|
587
|
+
# @see AttributeSets::Wgdevice::Flags
|
|
314
588
|
def flags; attributes[:"flags"]&.value; end
|
|
315
|
-
#
|
|
316
|
-
#--
|
|
589
|
+
# Set as ``0`` to choose randomly.
|
|
317
590
|
# @rbs return: ::Integer
|
|
591
|
+
# @return [Integer]
|
|
592
|
+
# @see AttributeSets::Wgdevice::ListenPort
|
|
318
593
|
def listen_port; attributes[:"listen_port"]&.value; end
|
|
319
|
-
#
|
|
320
|
-
#--
|
|
594
|
+
# Set as ``0`` to disable.
|
|
321
595
|
# @rbs return: ::Integer
|
|
596
|
+
# @return [Integer]
|
|
597
|
+
# @see AttributeSets::Wgdevice::Fwmark
|
|
322
598
|
def fwmark; attributes[:"fwmark"]&.value; end
|
|
323
|
-
#
|
|
324
|
-
|
|
599
|
+
# The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
600
|
+
# zero on ``GET_DEVICE`` operations.
|
|
325
601
|
# @rbs return: ::Array[AttributeSets::Wgpeer]
|
|
602
|
+
# @return [Array<AttributeSets::Wgpeer>]
|
|
603
|
+
# @see AttributeSets::Wgdevice::Peers
|
|
326
604
|
def peers; attributes[:"peers"]&.value; end
|
|
327
605
|
end
|
|
328
606
|
# Set WireGuard device
|
|
@@ -346,47 +624,58 @@ class Wireguard < ::Nl::Family
|
|
|
346
624
|
#
|
|
347
625
|
#
|
|
348
626
|
# Requires CAP_NET_ADMIN in the user namespace owning the network namespace.
|
|
349
|
-
class DoSetDeviceRequest < ::Nl::
|
|
627
|
+
class DoSetDeviceRequest < ::Nl::Genl::Message
|
|
350
628
|
TYPE = 1
|
|
351
629
|
FIXED_HEADER = nil
|
|
352
630
|
ATTRIBUTE_SET = AttributeSets::Wgdevice
|
|
353
631
|
ATTRIBUTES = Ractor.make_shareable(%i[ifindex ifname private_key public_key flags listen_port fwmark peers])
|
|
354
|
-
# Gets the value of `ifindex` attribute in the message.
|
|
355
|
-
#--
|
|
356
632
|
# @rbs return: ::Integer
|
|
633
|
+
# @return [Integer]
|
|
634
|
+
# @see AttributeSets::Wgdevice::Ifindex
|
|
357
635
|
def ifindex; attributes[:"ifindex"]&.value; end
|
|
358
|
-
# Gets the value of `ifname` attribute in the message.
|
|
359
|
-
#--
|
|
360
636
|
# @rbs return: ::String
|
|
637
|
+
# @return [String]
|
|
638
|
+
# @see AttributeSets::Wgdevice::Ifname
|
|
361
639
|
def ifname; attributes[:"ifname"]&.value; end
|
|
362
|
-
#
|
|
363
|
-
#--
|
|
640
|
+
# Set to all zeros to remove.
|
|
364
641
|
# @rbs return: ::String
|
|
642
|
+
# @return [String]
|
|
643
|
+
# @see AttributeSets::Wgdevice::PrivateKey
|
|
365
644
|
def private_key; attributes[:"private_key"]&.value; end
|
|
366
|
-
# Gets the value of `public-key` attribute in the message.
|
|
367
|
-
#--
|
|
368
645
|
# @rbs return: ::String
|
|
646
|
+
# @return [String]
|
|
647
|
+
# @see AttributeSets::Wgdevice::PublicKey
|
|
369
648
|
def public_key; attributes[:"public_key"]&.value; end
|
|
370
|
-
#
|
|
371
|
-
|
|
649
|
+
# ``0`` or ``WGDEVICE_F_REPLACE_PEERS`` if all current peers should be
|
|
650
|
+
# removed prior to adding the list below.
|
|
651
|
+
#
|
|
652
|
+
#
|
|
653
|
+
# Known flags are defined in {Flags::WgdeviceFlags}.
|
|
372
654
|
# @rbs return: ::Integer
|
|
655
|
+
# @return [Integer]
|
|
656
|
+
# @see AttributeSets::Wgdevice::Flags
|
|
373
657
|
def flags; attributes[:"flags"]&.value; end
|
|
374
|
-
#
|
|
375
|
-
#--
|
|
658
|
+
# Set as ``0`` to choose randomly.
|
|
376
659
|
# @rbs return: ::Integer
|
|
660
|
+
# @return [Integer]
|
|
661
|
+
# @see AttributeSets::Wgdevice::ListenPort
|
|
377
662
|
def listen_port; attributes[:"listen_port"]&.value; end
|
|
378
|
-
#
|
|
379
|
-
#--
|
|
663
|
+
# Set as ``0`` to disable.
|
|
380
664
|
# @rbs return: ::Integer
|
|
665
|
+
# @return [Integer]
|
|
666
|
+
# @see AttributeSets::Wgdevice::Fwmark
|
|
381
667
|
def fwmark; attributes[:"fwmark"]&.value; end
|
|
382
|
-
#
|
|
383
|
-
|
|
668
|
+
# The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
669
|
+
# zero on ``GET_DEVICE`` operations.
|
|
384
670
|
# @rbs return: ::Array[AttributeSets::Wgpeer]
|
|
671
|
+
# @return [Array<AttributeSets::Wgpeer>]
|
|
672
|
+
# @see AttributeSets::Wgdevice::Peers
|
|
385
673
|
def peers; attributes[:"peers"]&.value; end
|
|
386
674
|
end
|
|
387
675
|
end
|
|
388
676
|
module Notifications
|
|
389
677
|
end
|
|
678
|
+
# @private
|
|
390
679
|
NOTIFICATIONS = Ractor.make_shareable({}) #: Hash[::Integer, ::Class]
|
|
391
680
|
# Retrieve WireGuard device
|
|
392
681
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -415,9 +704,22 @@ class Wireguard < ::Nl::Family
|
|
|
415
704
|
#
|
|
416
705
|
#
|
|
417
706
|
# Requires CAP_NET_ADMIN in the user namespace owning the network namespace.
|
|
418
|
-
|
|
419
|
-
# @rbs (?ifindex: ::Integer, ?ifname: ::String) -> Enumerable[Messages::DumpGetDeviceReply]
|
|
707
|
+
# @rbs (?ifindex: ::Integer, ?ifname: ::String) -> Array[Messages::DumpGetDeviceReply]
|
|
420
708
|
# | (?ifindex: ::Integer, ?ifname: ::String) { (Messages::DumpGetDeviceReply) -> void } -> void
|
|
709
|
+
# @overload dump_get_device(**args)
|
|
710
|
+
# Returns an array when no block is given.
|
|
711
|
+
# @param [Hash] args
|
|
712
|
+
# @option args [Integer] ifindex
|
|
713
|
+
# @option args [String] ifname
|
|
714
|
+
# @return [Array<Messages::DumpGetDeviceReply>]
|
|
715
|
+
# @overload dump_get_device(**args, &block)
|
|
716
|
+
# Yields each reply when a block is given.
|
|
717
|
+
# @param [Hash] args
|
|
718
|
+
# @option args [Integer] ifindex
|
|
719
|
+
# @option args [String] ifname
|
|
720
|
+
# @yieldparam [Messages::DumpGetDeviceReply] reply
|
|
721
|
+
# @return [void]
|
|
722
|
+
# @see Messages::DumpGetDeviceRequest
|
|
421
723
|
def dump_get_device(**args, &block)
|
|
422
724
|
exchange_message(:"dump", Messages::DumpGetDeviceRequest, Messages::DumpGetDeviceReply, args, &block)
|
|
423
725
|
end
|
|
@@ -442,13 +744,28 @@ class Wireguard < ::Nl::Family
|
|
|
442
744
|
#
|
|
443
745
|
#
|
|
444
746
|
# Requires CAP_NET_ADMIN in the user namespace owning the network namespace.
|
|
445
|
-
|
|
446
|
-
# @
|
|
747
|
+
# @rbs (?ifindex: ::Integer, ?ifname: ::String, ?private_key: ::String, ?public_key: ::String, ?flags: ::Integer, ?listen_port: ::Integer, ?fwmark: ::Integer, ?peers: ::Array[(AttributeSets::Wgpeer | ::Hash[::Symbol, untyped])]) -> void
|
|
748
|
+
# @param [Hash] args
|
|
749
|
+
# @option args [Integer] ifindex
|
|
750
|
+
# @option args [String] ifname
|
|
751
|
+
# @option args [String] private_key Set to all zeros to remove.
|
|
752
|
+
# @option args [String] public_key
|
|
753
|
+
# @option args [Integer] flags ``0`` or ``WGDEVICE_F_REPLACE_PEERS`` if all current peers should be
|
|
754
|
+
# removed prior to adding the list below.
|
|
755
|
+
#
|
|
756
|
+
#
|
|
757
|
+
# Known flags are defined in {Flags::WgdeviceFlags}.
|
|
758
|
+
# @option args [Integer] listen_port Set as ``0`` to choose randomly.
|
|
759
|
+
# @option args [Integer] fwmark Set as ``0`` to disable.
|
|
760
|
+
# @option args [Array<AttributeSets::Wgpeer, Hash<Symbol, Object>>] peers The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
761
|
+
# zero on ``GET_DEVICE`` operations.
|
|
762
|
+
# @return [void]
|
|
763
|
+
# @see Messages::DoSetDeviceRequest
|
|
447
764
|
def do_set_device(**args)
|
|
448
765
|
exchange_message(:"do", Messages::DoSetDeviceRequest, nil, args)
|
|
449
766
|
end
|
|
450
767
|
class AsyncOperations
|
|
451
|
-
#
|
|
768
|
+
# @private
|
|
452
769
|
def initialize(&exchange)
|
|
453
770
|
@exchange = exchange
|
|
454
771
|
end
|
|
@@ -479,8 +796,12 @@ class Wireguard < ::Nl::Family
|
|
|
479
796
|
#
|
|
480
797
|
#
|
|
481
798
|
# Requires CAP_NET_ADMIN in the user namespace owning the network namespace.
|
|
482
|
-
#--
|
|
483
799
|
# @rbs (?ifindex: ::Integer, ?ifname: ::String) -> ::Nl::Async::Stream[Messages::DumpGetDeviceReply]
|
|
800
|
+
# @param [Hash] args
|
|
801
|
+
# @option args [Integer] ifindex
|
|
802
|
+
# @option args [String] ifname
|
|
803
|
+
# @return [Nl::Async::Stream<Messages::DumpGetDeviceReply>]
|
|
804
|
+
# @see Messages::DumpGetDeviceRequest
|
|
484
805
|
def dump_get_device(**args)
|
|
485
806
|
@exchange.call(:"dump", Messages::DumpGetDeviceRequest, Messages::DumpGetDeviceReply, args)
|
|
486
807
|
end
|
|
@@ -505,15 +826,31 @@ class Wireguard < ::Nl::Family
|
|
|
505
826
|
#
|
|
506
827
|
#
|
|
507
828
|
# Requires CAP_NET_ADMIN in the user namespace owning the network namespace.
|
|
508
|
-
|
|
509
|
-
# @
|
|
829
|
+
# @rbs (?ifindex: ::Integer, ?ifname: ::String, ?private_key: ::String, ?public_key: ::String, ?flags: ::Integer, ?listen_port: ::Integer, ?fwmark: ::Integer, ?peers: ::Array[(AttributeSets::Wgpeer | ::Hash[::Symbol, untyped])]) -> ::Nl::Async::Future[void]
|
|
830
|
+
# @param [Hash] args
|
|
831
|
+
# @option args [Integer] ifindex
|
|
832
|
+
# @option args [String] ifname
|
|
833
|
+
# @option args [String] private_key Set to all zeros to remove.
|
|
834
|
+
# @option args [String] public_key
|
|
835
|
+
# @option args [Integer] flags ``0`` or ``WGDEVICE_F_REPLACE_PEERS`` if all current peers should be
|
|
836
|
+
# removed prior to adding the list below.
|
|
837
|
+
#
|
|
838
|
+
#
|
|
839
|
+
# Known flags are defined in {Flags::WgdeviceFlags}.
|
|
840
|
+
# @option args [Integer] listen_port Set as ``0`` to choose randomly.
|
|
841
|
+
# @option args [Integer] fwmark Set as ``0`` to disable.
|
|
842
|
+
# @option args [Array<AttributeSets::Wgpeer, Hash<Symbol, Object>>] peers The index/type parameter is unused on ``SET_DEVICE`` operations and is
|
|
843
|
+
# zero on ``GET_DEVICE`` operations.
|
|
844
|
+
# @return [Nl::Async::Future<void>]
|
|
845
|
+
# @see Messages::DoSetDeviceRequest
|
|
510
846
|
def do_set_device(**args)
|
|
511
847
|
@exchange.call(:"do", Messages::DoSetDeviceRequest, nil, args)
|
|
512
848
|
end
|
|
513
849
|
end
|
|
514
850
|
# Returns the asynchronous operation facade for this family.
|
|
515
|
-
#--
|
|
516
851
|
# @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
|
|
852
|
+
# @param [::Integer, nil] stream_capacity
|
|
853
|
+
# @return [AsyncOperations]
|
|
517
854
|
def async(stream_capacity: nil)
|
|
518
855
|
return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
|
|
519
856
|
build_async_facade(AsyncOperations, stream_capacity:)
|