IPv6 needs Methods or Properties for address byte retrieval in little-endian #2

Merged
haraldwolff merged 1 commits from :master into master 2019-10-22 19:55:13 +02:00
1 changed files with 6 additions and 1 deletions

View File

@ -111,7 +111,9 @@ namespace ln.types.net
return bytes;
}
public byte[] ToCIDRBytes()
public byte[] ToCIDRBytes() => ToCIDRBytes(true);
public byte[] ToCIDRBytes(bool bigEndian)
{
byte[] bytes = new byte[17];
@ -122,9 +124,12 @@ namespace ln.types.net
}
bytes[16] = mask.GetBytes()[0];
if (bigEndian)
return bytes.BigEndian();
return bytes;
}
public IEnumerable<IPv6> Split(int splitWidth)
{
List<IPv6> splitted = new List<IPv6>();