UNPKG

@libp2p/websockets

Version:

JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec

34 lines 1.19 kB
import { WebSocketsSecure, WebSockets, DNS } from '@multiformats/multiaddr-matcher'; /** * @deprecated Configure this globally by passing a `connectionGater` to `createLibp2p` with a `denyDialMultiaddr` method that returns `false` */ export function all(multiaddrs) { return multiaddrs.filter((ma) => { return WebSocketsSecure.exactMatch(ma) || WebSockets.exactMatch(ma); }); } /** * @deprecated Configure this globally by passing a `connectionGater` to `createLibp2p` */ export function wss(multiaddrs) { return multiaddrs.filter((ma) => { return WebSocketsSecure.exactMatch(ma); }); } /** * @deprecated Configure this globally by passing a `connectionGater` to `createLibp2p` */ export function dnsWss(multiaddrs) { return multiaddrs.filter((ma) => { return DNS.matches(ma) && WebSocketsSecure.exactMatch(ma); }); } /** * @deprecated Configure this globally by passing a `connectionGater` to `createLibp2p` */ export function dnsWsOrWss(multiaddrs) { return multiaddrs.filter((ma) => { return DNS.matches(ma) && (WebSocketsSecure.exactMatch(ma) || WebSockets.exactMatch(ma)); }); } //# sourceMappingURL=filters.js.map