Bypass certificates on bypass auth

上级 8327da8d
...@@ -77,6 +77,10 @@ export const createApp = async (options: CreateAppOptions): Promise<{ ...@@ -77,6 +77,10 @@ export const createApp = async (options: CreateAppOptions): Promise<{
}; };
const isEncrypted = (socket: net.Socket): boolean => { const isEncrypted = (socket: net.Socket): boolean => {
if (options.bypassAuth) {
return true;
}
// tslint:disable-next-line:no-any // tslint:disable-next-line:no-any
return (socket as any).encrypted; return (socket as any).encrypted;
}; };
...@@ -125,7 +129,7 @@ export const createApp = async (options: CreateAppOptions): Promise<{ ...@@ -125,7 +129,7 @@ export const createApp = async (options: CreateAppOptions): Promise<{
}); });
}); });
const server = httpolyglot.createServer(options.httpsOptions || certs, app) as http.Server; const server = httpolyglot.createServer(options.bypassAuth ? {} : options.httpsOptions || certs, app) as http.Server;
const wss = new ws.Server({ server }); const wss = new ws.Server({ server });
wss.shouldHandle = (req): boolean => { wss.shouldHandle = (req): boolean => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册