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
157
node_modules/socks/typings/client/socksclient.d.ts
generated
vendored
Normal file
157
node_modules/socks/typings/client/socksclient.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
import { SocksClientOptions, SocksClientChainOptions, SocksRemoteHost, SocksProxy, SocksClientBoundEvent, SocksClientEstablishedEvent, SocksUDPFrameDetails } from '../common/constants';
|
||||
import { SocksClientError } from '../common/util';
|
||||
import { Duplex } from 'stream';
|
||||
interface SocksClient {
|
||||
on(event: 'error', listener: (err: SocksClientError) => void): this;
|
||||
on(event: 'bound', listener: (info: SocksClientBoundEvent) => void): this;
|
||||
on(event: 'established', listener: (info: SocksClientEstablishedEvent) => void): this;
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: 'error', listener: (err: SocksClientError) => void): this;
|
||||
once(event: 'bound', listener: (info: SocksClientBoundEvent) => void): this;
|
||||
once(event: 'established', listener: (info: SocksClientEstablishedEvent) => void): this;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: 'error', err: SocksClientError): boolean;
|
||||
emit(event: 'bound', info: SocksClientBoundEvent): boolean;
|
||||
emit(event: 'established', info: SocksClientEstablishedEvent): boolean;
|
||||
}
|
||||
declare class SocksClient extends EventEmitter implements SocksClient {
|
||||
private _options;
|
||||
private _socket;
|
||||
private _state;
|
||||
private _receiveBuffer;
|
||||
private _nextRequiredPacketBufferSize;
|
||||
private _onDataReceived;
|
||||
private _onClose;
|
||||
private _onError;
|
||||
private _onConnect;
|
||||
constructor(options: SocksClientOptions);
|
||||
/**
|
||||
* Creates a new SOCKS connection.
|
||||
*
|
||||
* Note: Supports callbacks and promises. Only supports the connect command.
|
||||
* @param options { SocksClientOptions } Options.
|
||||
* @param callback { Function } An optional callback function.
|
||||
* @returns { Promise }
|
||||
*/
|
||||
static createConnection(options: SocksClientOptions, callback?: Function): Promise<SocksClientEstablishedEvent>;
|
||||
/**
|
||||
* Creates a new SOCKS connection chain to a destination host through 2 or more SOCKS proxies.
|
||||
*
|
||||
* Note: Supports callbacks and promises. Only supports the connect method.
|
||||
* Note: Implemented via createConnection() factory function.
|
||||
* @param options { SocksClientChainOptions } Options
|
||||
* @param callback { Function } An optional callback function.
|
||||
* @returns { Promise }
|
||||
*/
|
||||
static createConnectionChain(options: SocksClientChainOptions, callback?: Function): Promise<SocksClientEstablishedEvent>;
|
||||
/**
|
||||
* Creates a SOCKS UDP Frame.
|
||||
* @param options
|
||||
*/
|
||||
static createUDPFrame(options: SocksUDPFrameDetails): Buffer;
|
||||
/**
|
||||
* Parses a SOCKS UDP frame.
|
||||
* @param data
|
||||
*/
|
||||
static parseUDPFrame(data: Buffer): SocksUDPFrameDetails;
|
||||
/**
|
||||
* Gets the SocksClient internal state.
|
||||
*/
|
||||
/**
|
||||
* Internal state setter. If the SocksClient is in an error state, it cannot be changed to a non error state.
|
||||
*/
|
||||
private state;
|
||||
/**
|
||||
* Starts the connection establishment to the proxy and destination.
|
||||
* @param existing_socket Connected socket to use instead of creating a new one (internal use).
|
||||
*/
|
||||
connect(existing_socket?: Duplex): void;
|
||||
/**
|
||||
* Handles internal Socks timeout callback.
|
||||
* Note: If the Socks client is not BoundWaitingForConnection or Established, the connection will be closed.
|
||||
*/
|
||||
private onEstablishedTimeout();
|
||||
/**
|
||||
* Handles Socket connect event.
|
||||
*/
|
||||
private onConnect();
|
||||
/**
|
||||
* Handles Socket data event.
|
||||
* @param data
|
||||
*/
|
||||
private onDataReceived(data);
|
||||
/**
|
||||
* Handles processing of the data we have received.
|
||||
*/
|
||||
private processData();
|
||||
/**
|
||||
* Handles Socket close event.
|
||||
* @param had_error
|
||||
*/
|
||||
private onClose();
|
||||
/**
|
||||
* Handles Socket error event.
|
||||
* @param err
|
||||
*/
|
||||
private onError(err);
|
||||
/**
|
||||
* Removes internal event listeners on the underlying Socket.
|
||||
*/
|
||||
private removeInternalSocketHandlers();
|
||||
/**
|
||||
* Closes and destroys the underlying Socket. Emits an error event.
|
||||
* @param err { String } An error string to include in error event.
|
||||
*/
|
||||
private _closeSocket(err);
|
||||
/**
|
||||
* Sends initial Socks v4 handshake request.
|
||||
*/
|
||||
private sendSocks4InitialHandshake();
|
||||
/**
|
||||
* Handles Socks v4 handshake response.
|
||||
* @param data
|
||||
*/
|
||||
private handleSocks4FinalHandshakeResponse();
|
||||
/**
|
||||
* Handles Socks v4 incoming connection request (BIND)
|
||||
* @param data
|
||||
*/
|
||||
private handleSocks4IncomingConnectionResponse();
|
||||
/**
|
||||
* Sends initial Socks v5 handshake request.
|
||||
*/
|
||||
private sendSocks5InitialHandshake();
|
||||
/**
|
||||
* Handles initial Socks v5 handshake response.
|
||||
* @param data
|
||||
*/
|
||||
private handleInitialSocks5HandshakeResponse();
|
||||
/**
|
||||
* Sends Socks v5 user & password auth handshake.
|
||||
*
|
||||
* Note: No auth and user/pass are currently supported.
|
||||
*/
|
||||
private sendSocks5UserPassAuthentication();
|
||||
/**
|
||||
* Handles Socks v5 auth handshake response.
|
||||
* @param data
|
||||
*/
|
||||
private handleInitialSocks5AuthenticationHandshakeResponse();
|
||||
/**
|
||||
* Sends Socks v5 final handshake request.
|
||||
*/
|
||||
private sendSocks5CommandRequest();
|
||||
/**
|
||||
* Handles Socks v5 final handshake response.
|
||||
* @param data
|
||||
*/
|
||||
private handleSocks5FinalHandshakeResponse();
|
||||
/**
|
||||
* Handles Socks v5 incoming connection request (BIND).
|
||||
*/
|
||||
private handleSocks5IncomingConnectionResponse();
|
||||
readonly socksClientOptions: SocksClientOptions;
|
||||
}
|
||||
export { SocksClient, SocksClientOptions, SocksClientChainOptions, SocksRemoteHost, SocksProxy, SocksUDPFrameDetails };
|
140
node_modules/socks/typings/common/constants.d.ts
generated
vendored
Normal file
140
node_modules/socks/typings/common/constants.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
/// <reference types="node" />
|
||||
import { Duplex } from 'stream';
|
||||
import { Socket } from 'net';
|
||||
import { RequireOnlyOne } from './util';
|
||||
declare const DEFAULT_TIMEOUT = 30000;
|
||||
declare type SocksProxyType = 4 | 5;
|
||||
declare const ERRORS: {
|
||||
InvalidSocksCommand: string;
|
||||
InvalidSocksCommandForOperation: string;
|
||||
InvalidSocksCommandChain: string;
|
||||
InvalidSocksClientOptionsDestination: string;
|
||||
InvalidSocksClientOptionsExistingSocket: string;
|
||||
InvalidSocksClientOptionsProxy: string;
|
||||
InvalidSocksClientOptionsTimeout: string;
|
||||
InvalidSocksClientOptionsProxiesLength: string;
|
||||
NegotiationError: string;
|
||||
SocketClosed: string;
|
||||
ProxyConnectionTimedOut: string;
|
||||
InternalError: string;
|
||||
InvalidSocks4HandshakeResponse: string;
|
||||
Socks4ProxyRejectedConnection: string;
|
||||
InvalidSocks4IncomingConnectionResponse: string;
|
||||
Socks4ProxyRejectedIncomingBoundConnection: string;
|
||||
InvalidSocks5InitialHandshakeResponse: string;
|
||||
InvalidSocks5IntiailHandshakeSocksVersion: string;
|
||||
InvalidSocks5InitialHandshakeNoAcceptedAuthType: string;
|
||||
InvalidSocks5InitialHandshakeUnknownAuthType: string;
|
||||
Socks5AuthenticationFailed: string;
|
||||
InvalidSocks5FinalHandshake: string;
|
||||
InvalidSocks5FinalHandshakeRejected: string;
|
||||
InvalidSocks5IncomingConnectionResponse: string;
|
||||
Socks5ProxyRejectedIncomingBoundConnection: string;
|
||||
};
|
||||
declare const SOCKS_INCOMING_PACKET_SIZES: {
|
||||
Socks5InitialHandshakeResponse: number;
|
||||
Socks5UserPassAuthenticationResponse: number;
|
||||
Socks5ResponseHeader: number;
|
||||
Socks5ResponseIPv4: number;
|
||||
Socks5ResponseIPv6: number;
|
||||
Socks5ResponseHostname: (hostNameLength: number) => number;
|
||||
Socks4Response: number;
|
||||
};
|
||||
declare type SocksCommandOption = 'connect' | 'bind' | 'associate';
|
||||
declare enum SocksCommand {
|
||||
connect = 1,
|
||||
bind = 2,
|
||||
associate = 3,
|
||||
}
|
||||
declare enum Socks4Response {
|
||||
Granted = 90,
|
||||
Failed = 91,
|
||||
Rejected = 92,
|
||||
RejectedIdent = 93,
|
||||
}
|
||||
declare enum Socks5Auth {
|
||||
NoAuth = 0,
|
||||
GSSApi = 1,
|
||||
UserPass = 2,
|
||||
}
|
||||
declare enum Socks5Response {
|
||||
Granted = 0,
|
||||
Failure = 1,
|
||||
NotAllowed = 2,
|
||||
NetworkUnreachable = 3,
|
||||
HostUnreachable = 4,
|
||||
ConnectionRefused = 5,
|
||||
TTLExpired = 6,
|
||||
CommandNotSupported = 7,
|
||||
AddressNotSupported = 8,
|
||||
}
|
||||
declare enum Socks5HostType {
|
||||
IPv4 = 1,
|
||||
Hostname = 3,
|
||||
IPv6 = 4,
|
||||
}
|
||||
declare enum SocksClientState {
|
||||
Created = 0,
|
||||
Connecting = 1,
|
||||
Connected = 2,
|
||||
SentInitialHandshake = 3,
|
||||
ReceivedInitialHandshakeResponse = 4,
|
||||
SentAuthentication = 5,
|
||||
ReceivedAuthenticationResponse = 6,
|
||||
SentFinalHandshake = 7,
|
||||
ReceivedFinalResponse = 8,
|
||||
BoundWaitingForConnection = 9,
|
||||
Established = 10,
|
||||
Disconnected = 11,
|
||||
Error = 99,
|
||||
}
|
||||
/**
|
||||
* Represents a SocksProxy
|
||||
*/
|
||||
declare type SocksProxy = RequireOnlyOne<{
|
||||
ipaddress?: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
type: SocksProxyType;
|
||||
userId?: string;
|
||||
password?: string;
|
||||
}, 'host' | 'ipaddress'>;
|
||||
/**
|
||||
* Represents a remote host
|
||||
*/
|
||||
interface SocksRemoteHost {
|
||||
host: string;
|
||||
port: number;
|
||||
}
|
||||
/**
|
||||
* SocksClient connection options.
|
||||
*/
|
||||
interface SocksClientOptions {
|
||||
command: SocksCommandOption;
|
||||
destination: SocksRemoteHost;
|
||||
proxy: SocksProxy;
|
||||
timeout?: number;
|
||||
existing_socket?: Duplex;
|
||||
set_tcp_nodelay?: boolean;
|
||||
}
|
||||
/**
|
||||
* SocksClient chain connection options.
|
||||
*/
|
||||
interface SocksClientChainOptions {
|
||||
command: 'connect';
|
||||
destination: SocksRemoteHost;
|
||||
proxies: SocksProxy[];
|
||||
timeout?: number;
|
||||
randomizeChain?: false;
|
||||
}
|
||||
interface SocksClientEstablishedEvent {
|
||||
socket: Socket;
|
||||
remoteHost?: SocksRemoteHost;
|
||||
}
|
||||
declare type SocksClientBoundEvent = SocksClientEstablishedEvent;
|
||||
interface SocksUDPFrameDetails {
|
||||
frameNumber?: number;
|
||||
remoteHost: SocksRemoteHost;
|
||||
data: Buffer;
|
||||
}
|
||||
export { DEFAULT_TIMEOUT, ERRORS, SocksProxyType, SocksCommand, Socks4Response, Socks5Auth, Socks5HostType, Socks5Response, SocksClientState, SocksProxy, SocksRemoteHost, SocksCommandOption, SocksClientOptions, SocksClientChainOptions, SocksClientEstablishedEvent, SocksClientBoundEvent, SocksUDPFrameDetails, SOCKS_INCOMING_PACKET_SIZES };
|
13
node_modules/socks/typings/common/helpers.d.ts
generated
vendored
Normal file
13
node_modules/socks/typings/common/helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { SocksClientOptions, SocksClientChainOptions } from '../client/socksclient';
|
||||
/**
|
||||
* Validates the provided SocksClientOptions
|
||||
* @param options { SocksClientOptions }
|
||||
* @param acceptedCommands { string[] } A list of accepted SocksProxy commands.
|
||||
*/
|
||||
declare function validateSocksClientOptions(options: SocksClientOptions, acceptedCommands?: string[]): void;
|
||||
/**
|
||||
* Validates the SocksClientChainOptions
|
||||
* @param options { SocksClientChainOptions }
|
||||
*/
|
||||
declare function validateSocksClientChainOptions(options: SocksClientChainOptions): void;
|
||||
export { validateSocksClientOptions, validateSocksClientChainOptions };
|
12
node_modules/socks/typings/common/receiveBuffer.d.ts
generated
vendored
Normal file
12
node_modules/socks/typings/common/receiveBuffer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/// <reference types="node" />
|
||||
declare class ReceiveBuffer {
|
||||
private _buffer;
|
||||
private _offset;
|
||||
private _originalSize;
|
||||
constructor(size?: number);
|
||||
readonly length: number;
|
||||
append(data: Buffer): number;
|
||||
peek(length: number): Buffer;
|
||||
get(length: number): Buffer;
|
||||
}
|
||||
export { ReceiveBuffer };
|
17
node_modules/socks/typings/common/util.d.ts
generated
vendored
Normal file
17
node_modules/socks/typings/common/util.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { SocksClientOptions, SocksClientChainOptions } from './constants';
|
||||
/**
|
||||
* Error wrapper for SocksClient
|
||||
*/
|
||||
declare class SocksClientError extends Error {
|
||||
options: SocksClientOptions | SocksClientChainOptions;
|
||||
constructor(message: string, options: SocksClientOptions | SocksClientChainOptions);
|
||||
}
|
||||
/**
|
||||
* Shuffles a given array.
|
||||
* @param array The array to shuffle.
|
||||
*/
|
||||
declare function shuffleArray(array: any[]): void;
|
||||
declare type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
||||
[K in Keys]?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
||||
}[Keys];
|
||||
export { RequireOnlyOne, SocksClientError, shuffleArray };
|
1
node_modules/socks/typings/index.d.ts
generated
vendored
Normal file
1
node_modules/socks/typings/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export * from './client/socksclient';
|
Loading…
Add table
Add a link
Reference in a new issue