-
-
Notifications
You must be signed in to change notification settings - Fork 713
Expand file tree
/
Copy pathline_socket.js
More file actions
24 lines (20 loc) · 688 Bytes
/
Copy pathline_socket.js
File metadata and controls
24 lines (20 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict'
// Back-compat shim. The Socket class lives in haraka-net-utils as LineSocket;
// the line-processing helper is `add_line_processor` there. The connect()
// helper stays here because it depends on Haraka's tls_socket.
const { LineSocket, add_line_processor } = require('haraka-net-utils')
const tls_socket = require('./tls_socket')
exports.Socket = LineSocket
// New interface - uses TLS
exports.connect = (port, host) => {
let options = {}
if (typeof port === 'object') {
options = port
} else {
options.port = port
options.host = host
}
const sock = tls_socket.connect(options)
add_line_processor(sock)
return sock
}