Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
feat: remove host support (#97)
Browse files Browse the repository at this point in the history
* feat: remove host support

BREAKING CHANGES: hostname should be used instead

* test: use latest dependency
  • Loading branch information
Kikobeats authored May 31, 2022
1 parent 73b75cf commit fcc3108
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"@commitlint/config-conventional": "latest",
"@types/debug": "latest",
"@types/node": "latest",
"cacheable-lookup": "^6.0.4",
"cacheable-lookup": "latest",
"conventional-github-releaser": "latest",
"dns2": "latest",
"finepack": "latest",
Expand Down
11 changes: 3 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import net from 'net'
import tls from 'tls'

interface BaseSocksProxyAgentOptions {
/**
* hostname is preferred over host
*
* @deprecated
*/
host?: string | null;
port?: string | number | null;
username?: string | null;
Expand All @@ -30,10 +25,10 @@ function parseSocksProxy (opts: SocksProxyAgentOptions): { lookup: boolean, prox
let lookup = false
let type: SocksProxy['type'] = 5

const host = opts.hostname || opts.host
const host = opts.hostname

if (host == null) {
throw new TypeError('No "hostname"')
throw new TypeError('No "host"')
}

if (typeof opts.port === 'number') {
Expand Down Expand Up @@ -115,7 +110,7 @@ const normalizeProxyOptions = (input: string | SocksProxyAgentOptions): SocksPro
proxyOptions = input
}
if (proxyOptions == null) {
throw new TypeError('a SOCKS proxy server `hostname` and `port` must be specified!')
throw new TypeError('a SOCKS proxy server `host` and `port` must be specified!')
}

return proxyOptions
Expand Down

0 comments on commit fcc3108

Please sign in to comment.