mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action! (#1)
This commit is contained in:
parent
8deacc95b1
commit
ace1e6a69a
3750 changed files with 1155519 additions and 0 deletions
15
node_modules/socks-proxy-agent/test/ssl-cert-snakeoil.key
generated
vendored
Normal file
15
node_modules/socks-proxy-agent/test/ssl-cert-snakeoil.key
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICWwIBAAKBgQCzURxIqzer0ACAbX/lHdsn4Gd9PLKrf7EeDYfIdV0HZKPD8WDr
|
||||
bBx2/fBu0OW2sjnzv/SVZbJ0DAuPE/p0+eT0qb2qC10iz9iTD7ribd7gxhirVb8y
|
||||
b3fBjXsxc8V8p4Ny1LcvNSqCjwUbJqdRogfoJeTiqPM58z5sNzuv5iq7iwIDAQAB
|
||||
AoGAPMQy4olrP0UotlzlJ36bowLP70ffgHCwU+/f4NWs5fF78c3du0oSx1w820Dd
|
||||
Z7E0JF8bgnlJJTxjumPZz0RUCugrEHBKJmzEz3cxF5E3+7NvteZcjKn9D67RrM5x
|
||||
1/uSZ9cqKE9cYvY4fSuHx18diyZ4axR/wB1Pea2utjjDM+ECQQDb9ZbmmaWMiRpQ
|
||||
5Up+loxP7BZNPsEVsm+DVJmEFbaFgGfncWBqSIqnPNjMwTwj0OigTwCAEGPkfRVW
|
||||
T0pbYWCxAkEA0LK7SCTwzyDmhASUalk0x+3uCAA6ryFdwJf/wd8TRAvVOmkTEldX
|
||||
uJ7ldLvfrONYO3v56uKTU/SoNdZYzKtO+wJAX2KM4ctXYy5BXztPpr2acz4qHa1N
|
||||
Bh+vBAC34fOYhyQ76r3b1btHhWZ5jbFuZwm9F2erC94Ps5IaoqcX07DSwQJAPKGw
|
||||
h2U0EPkd/3zVIZCJJQya+vgWFIs9EZcXVtvYXQyTBkVApTN66MhBIYjzkub5205J
|
||||
bVQmOV37AKklY1DhwQJAA1wos0cYxro02edzatxd0DIR2r4qqOqLkw6BhYHhq6HJ
|
||||
ZvIcQkHqdSXzdETFc01I1znDGGIrJHcnvKWgBPoEUg==
|
||||
-----END RSA PRIVATE KEY-----
|
12
node_modules/socks-proxy-agent/test/ssl-cert-snakeoil.pem
generated
vendored
Normal file
12
node_modules/socks-proxy-agent/test/ssl-cert-snakeoil.pem
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIB1TCCAT4CCQDV5mPlzm9+izANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDEyQ3
|
||||
NTI3YmQ3Ny1hYjNlLTQ3NGItYWNlNy1lZWQ2MDUzOTMxZTcwHhcNMTUwNzA2MjI0
|
||||
NTA3WhcNMjUwNzAzMjI0NTA3WjAvMS0wKwYDVQQDEyQ3NTI3YmQ3Ny1hYjNlLTQ3
|
||||
NGItYWNlNy1lZWQ2MDUzOTMxZTcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
|
||||
ALNRHEirN6vQAIBtf+Ud2yfgZ308sqt/sR4Nh8h1XQdko8PxYOtsHHb98G7Q5bay
|
||||
OfO/9JVlsnQMC48T+nT55PSpvaoLXSLP2JMPuuJt3uDGGKtVvzJvd8GNezFzxXyn
|
||||
g3LUty81KoKPBRsmp1GiB+gl5OKo8znzPmw3O6/mKruLAgMBAAEwDQYJKoZIhvcN
|
||||
AQEFBQADgYEACzoHUF8UV2Z6541Q2wKEA0UFUzmUjf/E1XwBO+1P15ZZ64uw34B4
|
||||
1RwMPtAo9RY/PmICTWtNxWGxkzwb2JtDWtnxVER/lF8k2XcXPE76fxTHJF/BKk9J
|
||||
QU8OTD1dd9gHCBviQB9TqntRZ5X7axjtuWjb2umY+owBYzAHZkp1HKI=
|
||||
-----END CERTIFICATE-----
|
144
node_modules/socks-proxy-agent/test/test.js
generated
vendored
Normal file
144
node_modules/socks-proxy-agent/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var url = require('url');
|
||||
var http = require('http');
|
||||
var https = require('https');
|
||||
var assert = require('assert');
|
||||
var socks = require('socksv5');
|
||||
var getRawBody = require('raw-body');
|
||||
var SocksProxyAgent = require('../');
|
||||
|
||||
describe('SocksProxyAgent', function () {
|
||||
var httpServer, httpPort;
|
||||
var httpsServer, httpsPort;
|
||||
var socksServer, socksPort;
|
||||
|
||||
before(function (done) {
|
||||
// setup SOCKS proxy server
|
||||
socksServer = socks.createServer(function(info, accept, deny) {
|
||||
accept();
|
||||
});
|
||||
socksServer.listen(0, '127.0.0.1', function() {
|
||||
socksPort = socksServer.address().port;
|
||||
//console.log('SOCKS server listening on port %d', socksPort);
|
||||
done();
|
||||
});
|
||||
socksServer.useAuth(socks.auth.None());
|
||||
//socksServer.useAuth(socks.auth.UserPassword(function(user, password, cb) {
|
||||
// cb(user === 'nodejs' && password === 'rules!');
|
||||
//}));
|
||||
});
|
||||
|
||||
before(function (done) {
|
||||
// setup target HTTP server
|
||||
httpServer = http.createServer();
|
||||
httpServer.listen(function () {
|
||||
httpPort = httpServer.address().port;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
before(function (done) {
|
||||
// setup target SSL HTTPS server
|
||||
var options = {
|
||||
key: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.key'),
|
||||
cert: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.pem')
|
||||
};
|
||||
httpsServer = https.createServer(options);
|
||||
httpsServer.listen(function () {
|
||||
httpsPort = httpsServer.address().port;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
socksServer.once('close', function () { done(); });
|
||||
socksServer.close();
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
httpServer.once('close', function () { done(); });
|
||||
httpServer.close();
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
httpsServer.once('close', function () { done(); });
|
||||
httpsServer.close();
|
||||
});
|
||||
|
||||
describe('constructor', function () {
|
||||
it('should throw an Error if no "proxy" argument is given', function () {
|
||||
assert.throws(function () {
|
||||
new SocksProxyAgent();
|
||||
});
|
||||
});
|
||||
it('should accept a "string" proxy argument', function () {
|
||||
var agent = new SocksProxyAgent('socks://127.0.0.1:' + socksPort);
|
||||
assert.equal('127.0.0.1', agent.proxy.host);
|
||||
assert.equal(socksPort, agent.proxy.port);
|
||||
});
|
||||
it('should accept a `url.parse()` result object argument', function () {
|
||||
var opts = url.parse('socks://127.0.0.1:' + socksPort);
|
||||
var agent = new SocksProxyAgent(opts);
|
||||
assert.equal('127.0.0.1', agent.proxy.host);
|
||||
assert.equal(socksPort, agent.proxy.port);
|
||||
});
|
||||
});
|
||||
|
||||
describe('"http" module', function () {
|
||||
it('should work against an HTTP endpoint', function (done) {
|
||||
httpServer.once('request', function (req, res) {
|
||||
assert.equal('/foo', req.url);
|
||||
res.statusCode = 404;
|
||||
res.end(JSON.stringify(req.headers));
|
||||
});
|
||||
|
||||
var agent = new SocksProxyAgent('socks://127.0.0.1:' + socksPort);
|
||||
var opts = url.parse('http://127.0.0.1:' + httpPort + '/foo');
|
||||
opts.agent = agent;
|
||||
opts.headers = { foo: 'bar' };
|
||||
var req = http.get(opts, function (res) {
|
||||
assert.equal(404, res.statusCode);
|
||||
getRawBody(res, 'utf8', function (err, buf) {
|
||||
if (err) return done(err);
|
||||
var data = JSON.parse(buf);
|
||||
assert.equal('bar', data.foo);
|
||||
done();
|
||||
});
|
||||
});
|
||||
req.once('error', done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('"https" module', function () {
|
||||
it('should work against an HTTPS endpoint', function (done) {
|
||||
httpsServer.once('request', function (req, res) {
|
||||
assert.equal('/foo', req.url);
|
||||
res.statusCode = 404;
|
||||
res.end(JSON.stringify(req.headers));
|
||||
});
|
||||
|
||||
var agent = new SocksProxyAgent('socks://127.0.0.1:' + socksPort);
|
||||
var opts = url.parse('https://127.0.0.1:' + httpsPort + '/foo');
|
||||
opts.agent = agent;
|
||||
opts.rejectUnauthorized = false;
|
||||
|
||||
opts.headers = { foo: 'bar' };
|
||||
var req = https.get(opts, function (res) {
|
||||
assert.equal(404, res.statusCode);
|
||||
getRawBody(res, 'utf8', function (err, buf) {
|
||||
if (err) return done(err);
|
||||
var data = JSON.parse(buf);
|
||||
assert.equal('bar', data.foo);
|
||||
done();
|
||||
});
|
||||
});
|
||||
req.once('error', done);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue