Skip to content

Commit

Permalink
tunnel server: add ALPN
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Razon committed Feb 12, 2024
1 parent ed206b9 commit 7838c1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tunnel-server/src/tls-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export const createTlsServer = ({ log, httpServer, sshServer, tlsConfig, sshHost
log.info('SSH hostnames: %j', sshHostnames)
const sshHostnamesSet = new Set(sshHostnames)

return tls.createServer(tlsConfig)
return tls.createServer({ ...tlsConfig, ALPNProtocols: ['http/1.1', 'ssh'] })
.on('error', err => { log.error(err) })
.on('secureConnection', socket => {
const { servername } = (socket as { servername?: string })
log.debug('TLS connection: %j', servername)
if (servername && sshHostnamesSet.has(servername)) {
if ((servername && sshHostnamesSet.has(servername)) || socket.alpnProtocol === 'ssh') {
sshServer.injectSocket(socket)
} else {
httpServer.emit('connection', socket)
Expand Down

0 comments on commit 7838c1f

Please sign in to comment.