UNPKG

xud

Version:
22 lines (21 loc) 959 B
import { Socket } from 'net'; import { Address } from '../p2p/types'; /** Helper methods for interacting with the [[Address]] type. */ declare const addressUtils: { /** * Create an [[Address]] using the remote host and port of a socket. */ fromSocket: (socket: Socket) => Address; /** * Create an [[Address]] from a string. * @param addressString a string in the "{host}:{port}" format * @param port a port number to use if no port is specified in the string, defaults to 8885 */ fromString: (addressString: string, port?: number) => Address; /** Convert an [[Address]] to a string in the "{host}:{port}" format. */ toString: (address: Address) => string; /** Checks whether two [[Address]] instances are equal, based solely on `host` and `port` fields */ areEqual: (a: Address, b: Address) => boolean; sortByLastConnected: (addresses: Address[]) => Address[]; }; export default addressUtils;