Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@fuman/net

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fuman/net - npm Package Compare versions

Comparing version
0.0.14
to
0.0.15
+18
ip/prettify.cjs
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
function prettify(address, options) {
const {
encloseIpv6 = false
} = options || {};
const isIpv6 = address.includes(":");
if (isIpv6) {
address = `[${address}]`;
}
const url = new URL(`http://${address}`);
const prettified = url.hostname;
if (isIpv6 && !encloseIpv6) {
return prettified.substring(1, prettified.length - 1);
}
return prettified;
}
exports.prettify = prettify;
export interface PrettifyOptions {
/**
* Whether to enclose IPv6 addresses into square brackets
* (according to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2))
*
* @default false
*/
encloseIpv6?: boolean;
}
export declare function prettify(address: string, options?: PrettifyOptions): string;
export interface PrettifyOptions {
/**
* Whether to enclose IPv6 addresses into square brackets
* (according to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2))
*
* @default false
*/
encloseIpv6?: boolean;
}
export declare function prettify(address: string, options?: PrettifyOptions): string;
function prettify(address, options) {
const {
encloseIpv6 = false
} = options || {};
const isIpv6 = address.includes(":");
if (isIpv6) {
address = `[${address}]`;
}
const url = new URL(`http://${address}`);
const prettified = url.hostname;
if (isIpv6 && !encloseIpv6) {
return prettified.substring(1, prettified.length - 1);
}
return prettified;
}
export {
prettify
};
+2
-0
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const parse = require("./parse.cjs");
const prettify = require("./prettify.cjs");
const v4 = require("./v4.cjs");

@@ -10,2 +11,3 @@ const v6 = require("./v6.cjs");

exports.stringifyWithPort = parse.stringifyWithPort;
exports.prettify = prettify.prettify;
exports.normalizeV4 = v4.normalizeV4;

@@ -12,0 +14,0 @@ exports.parseV4 = v4.parseV4;

export * from './parse.js';
export * from './prettify.js';
export * from './v4.js';
export * from './v6.js';
export * from './parse.js';
export * from './prettify.js';
export * from './v4.js';
export * from './v6.js';
import { parse, parseWithPort, stringify, stringifyWithPort } from "./parse.js";
import { prettify } from "./prettify.js";
import { normalizeV4, parseV4, stringifyV4 } from "./v4.js";

@@ -12,2 +13,3 @@ import { expandV6, fromBytesV6, parseV6, readV6, stringifyV6, toBytesV6, writeV6 } from "./v6.js";

parseWithPort,
prettify,
readV6,

@@ -14,0 +16,0 @@ stringify,

+3
-3
{
"name": "@fuman/net",
"type": "module",
"version": "0.0.14",
"version": "0.0.15",
"description": "experimental network abstractions",

@@ -9,4 +9,4 @@ "license": "MIT",

"dependencies": {
"@fuman/io": "^0.0.14",
"@fuman/utils": "^0.0.14"
"@fuman/io": "^0.0.15",
"@fuman/utils": "^0.0.15"
},

@@ -13,0 +13,0 @@ "exports": {

@@ -0,4 +1,4 @@

import { IReadable, IWritable } from '@fuman/io';
import { TcpEndpoint } from '../../types.js';
import { IReadable, IWritable } from '@fuman/io';
import { HttpProxySettings } from './types.js';
export declare function performHttpProxyHandshake(reader: IReadable, writer: IWritable, proxy: HttpProxySettings, destination: TcpEndpoint): Promise<void>;

@@ -0,4 +1,4 @@

import { IReadable, IWritable } from '@fuman/io';
import { TcpEndpoint } from '../../types.js';
import { IReadable, IWritable } from '@fuman/io';
import { HttpProxySettings } from './types.js';
export declare function performHttpProxyHandshake(reader: IReadable, writer: IWritable, proxy: HttpProxySettings, destination: TcpEndpoint): Promise<void>;