@@ -234,7 +234,92 @@ export class TcpAllPorts implements IPortRange {
234234}
235235
236236/**
237- * All TCP Ports
237+ * A single UDP port
238+ */
239+ export class UdpPort implements IPortRange {
240+ public readonly canInlineRule = true ;
241+
242+ constructor ( private readonly port : number ) {
243+ }
244+
245+ public toRuleJSON ( ) : any {
246+ return {
247+ ipProtocol : Protocol . Udp ,
248+ fromPort : this . port ,
249+ toPort : this . port
250+ } ;
251+ }
252+
253+ public toString ( ) {
254+ return `UDP ${ this . port } ` ;
255+ }
256+ }
257+
258+ /**
259+ * A single UDP port that is provided by a resource attribute
260+ */
261+ export class UdpPortFromAttribute implements IPortRange {
262+ public readonly canInlineRule = false ;
263+
264+ constructor ( private readonly port : string ) {
265+ }
266+
267+ public toRuleJSON ( ) : any {
268+ return {
269+ ipProtocol : Protocol . Udp ,
270+ fromPort : this . port ,
271+ toPort : this . port
272+ } ;
273+ }
274+
275+ public toString ( ) {
276+ return 'UDP {IndirectPort}' ;
277+ }
278+ }
279+
280+ /**
281+ * A UDP port range
282+ */
283+ export class UdpPortRange implements IPortRange {
284+ public readonly canInlineRule = true ;
285+
286+ constructor ( private readonly startPort : number , private readonly endPort : number ) {
287+ }
288+
289+ public toRuleJSON ( ) : any {
290+ return {
291+ ipProtocol : Protocol . Udp ,
292+ fromPort : this . startPort ,
293+ toPort : this . endPort
294+ } ;
295+ }
296+
297+ public toString ( ) {
298+ return `UDP ${ this . startPort } -${ this . endPort } ` ;
299+ }
300+ }
301+
302+ /**
303+ * All UDP Ports
304+ */
305+ export class UdpAllPorts implements IPortRange {
306+ public readonly canInlineRule = true ;
307+
308+ public toRuleJSON ( ) : any {
309+ return {
310+ ipProtocol : Protocol . Udp ,
311+ fromPort : 0 ,
312+ toPort : 65535
313+ } ;
314+ }
315+
316+ public toString ( ) {
317+ return 'UDP ALL PORTS' ;
318+ }
319+ }
320+
321+ /**
322+ * All Traffic
238323 */
239324export class AllConnections implements IPortRange {
240325 public readonly canInlineRule = true ;
0 commit comments