node-ikev2 0.2.1 → 0.3.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.
- package/lib/src/ip-address.js +2 -1
- package/lib/src/payload.d.ts +1 -19
- package/lib/src/payload.js +10 -29
- package/lib/src/selector.js +6 -6
- package/package.json +1 -1
package/lib/src/ip-address.js
CHANGED
|
@@ -32,8 +32,9 @@ function parseIPv4AddressString(addressString) {
|
|
|
32
32
|
return buffer;
|
|
33
33
|
}
|
|
34
34
|
function formatIPv4AddressBuffer(buffer) {
|
|
35
|
+
// Empty INTERNAL_IP4_* in CFG_REQUEST means "please assign" (RFC 7296).
|
|
35
36
|
if (buffer.length === 0) {
|
|
36
|
-
|
|
37
|
+
return "";
|
|
37
38
|
}
|
|
38
39
|
if (buffer.length !== 4) {
|
|
39
40
|
throw new Error(`Invalid IPv4 address ${buffer}`);
|
package/lib/src/payload.d.ts
CHANGED
|
@@ -106,7 +106,6 @@ export declare class PayloadSA extends Payload {
|
|
|
106
106
|
nextPayload: payloadType;
|
|
107
107
|
proposals: Proposal[];
|
|
108
108
|
critical: boolean;
|
|
109
|
-
length: number;
|
|
110
109
|
constructor(nextPayload: payloadType, proposals: Proposal[], critical?: boolean, length?: number);
|
|
111
110
|
/**
|
|
112
111
|
* Parses a Security Association Payload from a buffer
|
|
@@ -153,7 +152,6 @@ export declare class PayloadKE extends Payload {
|
|
|
153
152
|
dhGroup: number;
|
|
154
153
|
keyData: Buffer;
|
|
155
154
|
critical: boolean;
|
|
156
|
-
length: number;
|
|
157
155
|
constructor(nextPayload: payloadType, dhGroup: number, keyData: Buffer, critical?: boolean, length?: number);
|
|
158
156
|
/**
|
|
159
157
|
* Parses a Key Exchange Payload from a buffer
|
|
@@ -213,7 +211,6 @@ export declare class PayloadID extends Payload {
|
|
|
213
211
|
idType: number;
|
|
214
212
|
idData: Buffer;
|
|
215
213
|
critical: boolean;
|
|
216
|
-
length: number;
|
|
217
214
|
constructor(nextPayload: payloadType, idType: number, idData: Buffer, critical?: boolean, length?: number);
|
|
218
215
|
/**
|
|
219
216
|
* Parses an Identification Payload from a buffer
|
|
@@ -260,7 +257,6 @@ export declare class PayloadIDi extends PayloadID {
|
|
|
260
257
|
idType: number;
|
|
261
258
|
idData: Buffer;
|
|
262
259
|
critical: boolean;
|
|
263
|
-
length: number;
|
|
264
260
|
constructor(nextPayload: payloadType, idType: number, idData: Buffer, critical?: boolean, length?: number);
|
|
265
261
|
}
|
|
266
262
|
/**
|
|
@@ -273,8 +269,7 @@ export declare class PayloadIDr extends PayloadID {
|
|
|
273
269
|
idType: number;
|
|
274
270
|
idData: Buffer;
|
|
275
271
|
critical: boolean;
|
|
276
|
-
|
|
277
|
-
constructor(nextPayload: payloadType, idType: number, idData: Buffer, critical: boolean, length: number);
|
|
272
|
+
constructor(nextPayload: payloadType, idType: number, idData: Buffer, critical?: boolean, length?: number);
|
|
278
273
|
}
|
|
279
274
|
/**
|
|
280
275
|
* IKEv2 Notify Message Types
|
|
@@ -307,7 +302,6 @@ export declare class PayloadCERT extends Payload {
|
|
|
307
302
|
certEncoding: number;
|
|
308
303
|
certData: Buffer;
|
|
309
304
|
critical: boolean;
|
|
310
|
-
length: number;
|
|
311
305
|
constructor(nextPayload: payloadType, certEncoding: number, certData: Buffer, critical?: boolean, length?: number);
|
|
312
306
|
/**
|
|
313
307
|
* Parses a Certificate Payload from a buffer
|
|
@@ -354,7 +348,6 @@ export declare class PayloadCERTREQ extends Payload {
|
|
|
354
348
|
certEncoding: number;
|
|
355
349
|
certAuthority: Buffer;
|
|
356
350
|
critical: boolean;
|
|
357
|
-
length: number;
|
|
358
351
|
constructor(nextPayload: payloadType, certEncoding: number, certAuthority: Buffer, critical?: boolean, length?: number);
|
|
359
352
|
/**
|
|
360
353
|
* Parses a Certificate Request Payload from a buffer
|
|
@@ -401,7 +394,6 @@ export declare class PayloadAUTH extends Payload {
|
|
|
401
394
|
authMethod: number;
|
|
402
395
|
authData: Buffer;
|
|
403
396
|
critical: boolean;
|
|
404
|
-
length: number;
|
|
405
397
|
constructor(nextPayload: payloadType, authMethod: number, authData: Buffer, critical?: boolean, length?: number);
|
|
406
398
|
/**
|
|
407
399
|
* Parses an Authentication Payload from a buffer
|
|
@@ -447,7 +439,6 @@ export declare class PayloadNONCE extends Payload {
|
|
|
447
439
|
nextPayload: payloadType;
|
|
448
440
|
nonceData: Buffer;
|
|
449
441
|
critical: boolean;
|
|
450
|
-
length: number;
|
|
451
442
|
constructor(nextPayload: payloadType, nonceData: Buffer, critical?: boolean, length?: number);
|
|
452
443
|
/**
|
|
453
444
|
* Parses a Nonce Payload from a buffer
|
|
@@ -593,7 +584,6 @@ export declare class PayloadNOTIFY extends Payload {
|
|
|
593
584
|
spi: Buffer;
|
|
594
585
|
notifyData: Buffer;
|
|
595
586
|
critical: boolean;
|
|
596
|
-
length: number;
|
|
597
587
|
constructor(nextPayload: payloadType, protocolId: securityProtocolId, spiSize: number, notifyType: number, spi: Buffer, notifyData: Buffer, critical?: boolean, length?: number);
|
|
598
588
|
/**
|
|
599
589
|
* Parses a Notify Payload from a buffer
|
|
@@ -642,7 +632,6 @@ export declare class PayloadDELETE extends Payload {
|
|
|
642
632
|
numSpi: number;
|
|
643
633
|
spis: Buffer[];
|
|
644
634
|
critical: boolean;
|
|
645
|
-
length: number;
|
|
646
635
|
constructor(nextPayload: payloadType, protocolId: number, spiSize: number, numSpi: number, spis: Buffer[], critical?: boolean, length?: number);
|
|
647
636
|
/**
|
|
648
637
|
* Parses a Delete Payload from a buffer
|
|
@@ -688,7 +677,6 @@ export declare class PayloadVENDOR extends Payload {
|
|
|
688
677
|
nextPayload: payloadType;
|
|
689
678
|
vendorId: Buffer;
|
|
690
679
|
critical: boolean;
|
|
691
|
-
length: number;
|
|
692
680
|
constructor(nextPayload: payloadType, vendorId: Buffer, critical?: boolean, length?: number);
|
|
693
681
|
/**
|
|
694
682
|
* Parses a Vendor ID Payload from a buffer
|
|
@@ -735,7 +723,6 @@ export declare class PayloadTS extends Payload {
|
|
|
735
723
|
tsType: payloadType;
|
|
736
724
|
tsList: TrafficSelector[];
|
|
737
725
|
critical: boolean;
|
|
738
|
-
length: number;
|
|
739
726
|
constructor(nextPayload: payloadType, tsType: payloadType, tsList: TrafficSelector[], critical?: boolean, length?: number);
|
|
740
727
|
/**
|
|
741
728
|
* Parses a Traffic Selector Payload from a buffer
|
|
@@ -781,7 +768,6 @@ export declare class PayloadTSi extends PayloadTS {
|
|
|
781
768
|
nextPayload: payloadType;
|
|
782
769
|
tsList: TrafficSelector[];
|
|
783
770
|
critical: boolean;
|
|
784
|
-
length: number;
|
|
785
771
|
constructor(nextPayload: payloadType, tsList: TrafficSelector[], critical?: boolean, length?: number);
|
|
786
772
|
}
|
|
787
773
|
/**
|
|
@@ -793,7 +779,6 @@ export declare class PayloadTSr extends PayloadTS {
|
|
|
793
779
|
nextPayload: payloadType;
|
|
794
780
|
tsList: TrafficSelector[];
|
|
795
781
|
critical: boolean;
|
|
796
|
-
length: number;
|
|
797
782
|
constructor(nextPayload: payloadType, tsList: TrafficSelector[], critical?: boolean, length?: number);
|
|
798
783
|
}
|
|
799
784
|
/**
|
|
@@ -805,7 +790,6 @@ export declare class PayloadSK extends Payload {
|
|
|
805
790
|
nextPayload: payloadType;
|
|
806
791
|
encryptedData: Buffer;
|
|
807
792
|
critical: boolean;
|
|
808
|
-
length: number;
|
|
809
793
|
constructor(nextPayload: payloadType, encryptedData: Buffer, critical?: boolean, length?: number);
|
|
810
794
|
/**
|
|
811
795
|
* Parses an SK Payload from a buffer
|
|
@@ -912,7 +896,6 @@ export declare class PayloadCP extends Payload {
|
|
|
912
896
|
cfgType: number;
|
|
913
897
|
cfgData: Buffer;
|
|
914
898
|
critical: boolean;
|
|
915
|
-
length: number;
|
|
916
899
|
constructor(nextPayload: payloadType, cfgType: number, cfgData: Buffer, critical?: boolean, length?: number);
|
|
917
900
|
/**
|
|
918
901
|
* Parses a Configuration Payload from a buffer
|
|
@@ -958,7 +941,6 @@ export declare class PayloadEAP extends Payload {
|
|
|
958
941
|
nextPayload: payloadType;
|
|
959
942
|
eapMessage: Buffer;
|
|
960
943
|
critical: boolean;
|
|
961
|
-
length: number;
|
|
962
944
|
constructor(nextPayload: payloadType, eapMessage: Buffer, critical?: boolean, length?: number);
|
|
963
945
|
/**
|
|
964
946
|
* Parses an EAP Payload from a buffer
|
package/lib/src/payload.js
CHANGED
|
@@ -226,7 +226,6 @@ class PayloadSA extends Payload {
|
|
|
226
226
|
this.nextPayload = nextPayload;
|
|
227
227
|
this.proposals = proposals;
|
|
228
228
|
this.critical = critical;
|
|
229
|
-
this.length = length;
|
|
230
229
|
}
|
|
231
230
|
/**
|
|
232
231
|
* Parses a Security Association Payload from a buffer
|
|
@@ -339,7 +338,6 @@ class PayloadKE extends Payload {
|
|
|
339
338
|
this.dhGroup = dhGroup;
|
|
340
339
|
this.keyData = keyData;
|
|
341
340
|
this.critical = critical;
|
|
342
|
-
this.length = length;
|
|
343
341
|
}
|
|
344
342
|
/**
|
|
345
343
|
* Parses a Key Exchange Payload from a buffer
|
|
@@ -469,12 +467,11 @@ var IDType;
|
|
|
469
467
|
*/
|
|
470
468
|
class PayloadID extends Payload {
|
|
471
469
|
constructor(nextPayload, idType, idData, critical = false, length = 0) {
|
|
472
|
-
super(payloadType.NONE, nextPayload, critical, length > 0 ? length :
|
|
470
|
+
super(payloadType.NONE, nextPayload, critical, length > 0 ? length : 8 + idData.length);
|
|
473
471
|
this.nextPayload = nextPayload;
|
|
474
472
|
this.idType = idType;
|
|
475
473
|
this.idData = idData;
|
|
476
474
|
this.critical = critical;
|
|
477
|
-
this.length = length;
|
|
478
475
|
}
|
|
479
476
|
/**
|
|
480
477
|
* Parses an Identification Payload from a buffer
|
|
@@ -593,12 +590,11 @@ exports.PayloadID = PayloadID;
|
|
|
593
590
|
*/
|
|
594
591
|
class PayloadIDi extends PayloadID {
|
|
595
592
|
constructor(nextPayload, idType, idData, critical = false, length = 0) {
|
|
596
|
-
super(nextPayload, idType, idData, critical, length > 0 ? length :
|
|
593
|
+
super(nextPayload, idType, idData, critical, length > 0 ? length : 8 + idData.length);
|
|
597
594
|
this.nextPayload = nextPayload;
|
|
598
595
|
this.idType = idType;
|
|
599
596
|
this.idData = idData;
|
|
600
597
|
this.critical = critical;
|
|
601
|
-
this.length = length;
|
|
602
598
|
this.type = payloadType.IDi;
|
|
603
599
|
}
|
|
604
600
|
}
|
|
@@ -609,13 +605,12 @@ exports.PayloadIDi = PayloadIDi;
|
|
|
609
605
|
* @extends PayloadID
|
|
610
606
|
*/
|
|
611
607
|
class PayloadIDr extends PayloadID {
|
|
612
|
-
constructor(nextPayload, idType, idData, critical, length) {
|
|
613
|
-
super(nextPayload, idType, idData, critical, length > 0 ? length :
|
|
608
|
+
constructor(nextPayload, idType, idData, critical = false, length = 0) {
|
|
609
|
+
super(nextPayload, idType, idData, critical, length > 0 ? length : 8 + idData.length);
|
|
614
610
|
this.nextPayload = nextPayload;
|
|
615
611
|
this.idType = idType;
|
|
616
612
|
this.idData = idData;
|
|
617
613
|
this.critical = critical;
|
|
618
|
-
this.length = length;
|
|
619
614
|
this.type = payloadType.IDr;
|
|
620
615
|
}
|
|
621
616
|
}
|
|
@@ -654,7 +649,6 @@ class PayloadCERT extends Payload {
|
|
|
654
649
|
this.certEncoding = certEncoding;
|
|
655
650
|
this.certData = certData;
|
|
656
651
|
this.critical = critical;
|
|
657
|
-
this.length = length;
|
|
658
652
|
}
|
|
659
653
|
/**
|
|
660
654
|
* Parses a Certificate Payload from a buffer
|
|
@@ -740,7 +734,6 @@ class PayloadCERTREQ extends Payload {
|
|
|
740
734
|
this.certEncoding = certEncoding;
|
|
741
735
|
this.certAuthority = certAuthority;
|
|
742
736
|
this.critical = critical;
|
|
743
|
-
this.length = length;
|
|
744
737
|
}
|
|
745
738
|
/**
|
|
746
739
|
* Parses a Certificate Request Payload from a buffer
|
|
@@ -813,12 +806,11 @@ exports.PayloadCERTREQ = PayloadCERTREQ;
|
|
|
813
806
|
*/
|
|
814
807
|
class PayloadAUTH extends Payload {
|
|
815
808
|
constructor(nextPayload, authMethod, authData, critical = false, length = 0) {
|
|
816
|
-
super(payloadType.AUTH, nextPayload, critical, length > 0 ? length :
|
|
809
|
+
super(payloadType.AUTH, nextPayload, critical, length > 0 ? length : 8 + authData.length);
|
|
817
810
|
this.nextPayload = nextPayload;
|
|
818
811
|
this.authMethod = authMethod;
|
|
819
812
|
this.authData = authData;
|
|
820
813
|
this.critical = critical;
|
|
821
|
-
this.length = length;
|
|
822
814
|
}
|
|
823
815
|
/**
|
|
824
816
|
* Parses an Authentication Payload from a buffer
|
|
@@ -901,7 +893,6 @@ class PayloadNONCE extends Payload {
|
|
|
901
893
|
this.nextPayload = nextPayload;
|
|
902
894
|
this.nonceData = nonceData;
|
|
903
895
|
this.critical = critical;
|
|
904
|
-
this.length = length;
|
|
905
896
|
}
|
|
906
897
|
/**
|
|
907
898
|
* Parses a Nonce Payload from a buffer
|
|
@@ -1079,7 +1070,6 @@ class PayloadNOTIFY extends Payload {
|
|
|
1079
1070
|
this.spi = spi;
|
|
1080
1071
|
this.notifyData = notifyData;
|
|
1081
1072
|
this.critical = critical;
|
|
1082
|
-
this.length = length;
|
|
1083
1073
|
}
|
|
1084
1074
|
/**
|
|
1085
1075
|
* Parses a Notify Payload from a buffer
|
|
@@ -1176,7 +1166,6 @@ class PayloadDELETE extends Payload {
|
|
|
1176
1166
|
this.numSpi = numSpi;
|
|
1177
1167
|
this.spis = spis;
|
|
1178
1168
|
this.critical = critical;
|
|
1179
|
-
this.length = length;
|
|
1180
1169
|
}
|
|
1181
1170
|
/**
|
|
1182
1171
|
* Parses a Delete Payload from a buffer
|
|
@@ -1279,7 +1268,6 @@ class PayloadVENDOR extends Payload {
|
|
|
1279
1268
|
this.nextPayload = nextPayload;
|
|
1280
1269
|
this.vendorId = vendorId;
|
|
1281
1270
|
this.critical = critical;
|
|
1282
|
-
this.length = length;
|
|
1283
1271
|
}
|
|
1284
1272
|
/**
|
|
1285
1273
|
* Parses a Vendor ID Payload from a buffer
|
|
@@ -1348,12 +1336,11 @@ exports.PayloadVENDOR = PayloadVENDOR;
|
|
|
1348
1336
|
*/
|
|
1349
1337
|
class PayloadTS extends Payload {
|
|
1350
1338
|
constructor(nextPayload, tsType, tsList, critical = false, length = 0) {
|
|
1351
|
-
super(tsType, nextPayload, critical, length > 0 ? length : 0);
|
|
1339
|
+
super(tsType, nextPayload, critical, length > 0 ? length : 8 + tsList.reduce((acc, ts) => acc + ts.length, 0));
|
|
1352
1340
|
this.nextPayload = nextPayload;
|
|
1353
1341
|
this.tsType = tsType;
|
|
1354
1342
|
this.tsList = tsList;
|
|
1355
1343
|
this.critical = critical;
|
|
1356
|
-
this.length = length;
|
|
1357
1344
|
}
|
|
1358
1345
|
/**
|
|
1359
1346
|
* Parses a Traffic Selector Payload from a buffer
|
|
@@ -1383,12 +1370,11 @@ class PayloadTS extends Payload {
|
|
|
1383
1370
|
*/
|
|
1384
1371
|
static serializeJSON(json) {
|
|
1385
1372
|
var _a;
|
|
1386
|
-
// const type = json.type; // TODO include the type in the JSON, as it is discriminating
|
|
1387
1373
|
const buffer = Buffer.alloc(json.length);
|
|
1388
1374
|
const genericPayload = Payload.serializeJSON(json);
|
|
1389
1375
|
genericPayload.copy(buffer);
|
|
1390
1376
|
buffer.writeUInt8(json.numTs, 4);
|
|
1391
|
-
const tsListBuffer = ((_a = json.
|
|
1377
|
+
const tsListBuffer = ((_a = json.tsList) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
1392
1378
|
? json.tsList.map((ts) => selector_1.TrafficSelector.serializeJSON(ts))
|
|
1393
1379
|
: [Buffer.alloc(0)];
|
|
1394
1380
|
let offset = 8;
|
|
@@ -1447,11 +1433,10 @@ exports.PayloadTS = PayloadTS;
|
|
|
1447
1433
|
*/
|
|
1448
1434
|
class PayloadTSi extends PayloadTS {
|
|
1449
1435
|
constructor(nextPayload, tsList, critical = false, length = 0) {
|
|
1450
|
-
super(nextPayload, payloadType.TSi, tsList, critical, length
|
|
1436
|
+
super(nextPayload, payloadType.TSi, tsList, critical, length);
|
|
1451
1437
|
this.nextPayload = nextPayload;
|
|
1452
1438
|
this.tsList = tsList;
|
|
1453
1439
|
this.critical = critical;
|
|
1454
|
-
this.length = length;
|
|
1455
1440
|
this.type = payloadType.TSi;
|
|
1456
1441
|
}
|
|
1457
1442
|
}
|
|
@@ -1463,11 +1448,10 @@ exports.PayloadTSi = PayloadTSi;
|
|
|
1463
1448
|
*/
|
|
1464
1449
|
class PayloadTSr extends PayloadTS {
|
|
1465
1450
|
constructor(nextPayload, tsList, critical = false, length = 0) {
|
|
1466
|
-
super(nextPayload, payloadType.TSr, tsList, critical, length
|
|
1451
|
+
super(nextPayload, payloadType.TSr, tsList, critical, length);
|
|
1467
1452
|
this.nextPayload = nextPayload;
|
|
1468
1453
|
this.tsList = tsList;
|
|
1469
1454
|
this.critical = critical;
|
|
1470
|
-
this.length = length;
|
|
1471
1455
|
this.type = payloadType.TSr;
|
|
1472
1456
|
}
|
|
1473
1457
|
}
|
|
@@ -1483,7 +1467,6 @@ class PayloadSK extends Payload {
|
|
|
1483
1467
|
this.nextPayload = nextPayload;
|
|
1484
1468
|
this.encryptedData = encryptedData;
|
|
1485
1469
|
this.critical = critical;
|
|
1486
|
-
this.length = length;
|
|
1487
1470
|
}
|
|
1488
1471
|
/**
|
|
1489
1472
|
* Parses an SK Payload from a buffer
|
|
@@ -1668,12 +1651,11 @@ var cfgType;
|
|
|
1668
1651
|
*/
|
|
1669
1652
|
class PayloadCP extends Payload {
|
|
1670
1653
|
constructor(nextPayload, cfgType, cfgData, critical = false, length = 0) {
|
|
1671
|
-
super(payloadType.CP, nextPayload, critical, length > 0 ? length :
|
|
1654
|
+
super(payloadType.CP, nextPayload, critical, length > 0 ? length : 8 + cfgData.length);
|
|
1672
1655
|
this.nextPayload = nextPayload;
|
|
1673
1656
|
this.cfgType = cfgType;
|
|
1674
1657
|
this.cfgData = cfgData;
|
|
1675
1658
|
this.critical = critical;
|
|
1676
|
-
this.length = length;
|
|
1677
1659
|
}
|
|
1678
1660
|
/**
|
|
1679
1661
|
* Parses a Configuration Payload from a buffer
|
|
@@ -1752,7 +1734,6 @@ class PayloadEAP extends Payload {
|
|
|
1752
1734
|
this.nextPayload = nextPayload;
|
|
1753
1735
|
this.eapMessage = eapMessage;
|
|
1754
1736
|
this.critical = critical;
|
|
1755
|
-
this.length = length;
|
|
1756
1737
|
}
|
|
1757
1738
|
/**
|
|
1758
1739
|
* Parses an EAP Payload from a buffer
|
package/lib/src/selector.js
CHANGED
|
@@ -59,7 +59,7 @@ class TrafficSelector {
|
|
|
59
59
|
static parse(buffer) {
|
|
60
60
|
try {
|
|
61
61
|
const type = buffer.readUInt8(0);
|
|
62
|
-
|
|
62
|
+
let expectedLength;
|
|
63
63
|
switch (type) {
|
|
64
64
|
case TrafficSelectorType.TS_IPV4_ADDR_RANGE:
|
|
65
65
|
expectedLength = 16;
|
|
@@ -77,8 +77,8 @@ class TrafficSelector {
|
|
|
77
77
|
}
|
|
78
78
|
const startPort = buffer.readUInt16BE(4);
|
|
79
79
|
const endPort = buffer.readUInt16BE(6);
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
let startAddress;
|
|
81
|
+
let endAddress;
|
|
82
82
|
switch (type) {
|
|
83
83
|
case TrafficSelectorType.TS_IPV4_ADDR_RANGE:
|
|
84
84
|
startAddress = buffer.subarray(8, 12);
|
|
@@ -105,8 +105,8 @@ class TrafficSelector {
|
|
|
105
105
|
* @returns {Buffer}
|
|
106
106
|
*/
|
|
107
107
|
static serializeJSON(json) {
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
let length;
|
|
109
|
+
let ipLength;
|
|
110
110
|
const startAddress = (0, ip_address_1.parseIPAddressString)(json.startAddress);
|
|
111
111
|
const endAddress = (0, ip_address_1.parseIPAddressString)(json.endAddress);
|
|
112
112
|
if (startAddress.length === 4 && endAddress.length === 4) {
|
|
@@ -136,7 +136,7 @@ class TrafficSelector {
|
|
|
136
136
|
* @returns {Buffer}
|
|
137
137
|
*/
|
|
138
138
|
serialize() {
|
|
139
|
-
|
|
139
|
+
let ipLength;
|
|
140
140
|
switch (this.type) {
|
|
141
141
|
case TrafficSelectorType.TS_IPV4_ADDR_RANGE:
|
|
142
142
|
if (this.startAddress.length != 4 || this.endAddress.length != 4) {
|