Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1x 1x 1x 151x 151x 151x 151x | import { BufferReader } from '@node-dlc/bufio';
import { AddressIPv4 } from '../../domain/AddressIPv4';
import { ipv4StringFromBuffer } from './ipv4StringFromBuffer';
/**
* Deserializes an IPv4 address from a reader and
* returns an instance of an IPv4 Address.
*/
export function deserializeIPv4(reader: BufferReader): AddressIPv4 {
const hostBytes = reader.readBytes(4);
const port = reader.readUInt16BE();
const host = ipv4StringFromBuffer(hostBytes);
return new AddressIPv4(host, port);
}
|