mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-16 15:40:01 -04:00
18 lines
354 B
TypeScript
18 lines
354 B
TypeScript
/*
|
|
* WebSocket helpers
|
|
*/
|
|
|
|
const validChars =
|
|
"!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~";
|
|
|
|
export function validProtocol(protocol: string): boolean {
|
|
for (let i = 0; i < protocol.length; i++) {
|
|
const char = protocol[i];
|
|
|
|
if (!validChars.includes(char)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|