-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Chen
committed
Feb 12, 2016
1 parent
b7f1813
commit 4ca9c01
Showing
6 changed files
with
115 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const request = require('request'); | ||
const socks = require('socksv5'); | ||
|
||
module.exports = function (config) { | ||
var proxyConfig = config.proxy; | ||
|
||
if (proxyConfig) { | ||
return request.defaults({ | ||
agentClass: socks.HttpsAgent, | ||
agentOptions: { | ||
proxyHost: proxyConfig.host, | ||
proxyPort: proxyConfig.port, | ||
auths: [ | ||
proxyConfig.auth ? | ||
socks.auth.UserPassword(proxyConfig.auth.username, proxyConfig.auth.password) : | ||
socks.auth.None() | ||
] | ||
} | ||
}); | ||
} | ||
|
||
return request; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters