Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: match websocket addresses that include a peer id #156

Merged
merged 2 commits into from
Jun 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,28 @@ export const UTP = and(UDP, base('utp'))
export const QUIC = and(UDP, base('quic'))
export const QUICV1 = and(UDP, base('quic-v1'))

export const WebSockets = or(
const _WebSockets = or(
and(TCP, base('ws')),
and(DNS, base('ws'))
)

export const WebSocketsSecure = or(
export const WebSockets = or(
_WebSockets,
and(_WebSockets, base('p2p'))
)

const _WebSocketsSecure = or(
and(TCP, base('wss')),
and(DNS, base('wss')),
and(TCP, base('tls'), base('ws')),
and(DNS, base('tls'), base('ws'))
)

export const WebSocketsSecure = or(
_WebSocketsSecure,
and(_WebSocketsSecure, base('p2p'))
)

export const HTTP = or(
and(TCP, base('http')),
and(IP, base('http')),
Expand Down Expand Up @@ -99,8 +109,8 @@ export const P2PWebRTCDirect = or(
)

export const Reliable = or(
WebSockets,
WebSocketsSecure,
_WebSockets,
_WebSocketsSecure,
HTTP,
HTTPS,
P2PWebRTCStar,
Expand Down