import * as net from 'net';
export interface SocksServerOptions {
    /**
     * An array of authentication methods to be used for incoming SOCKS5
     * connections, in preference order. This defaults to `['no-auth']`.
     *
     * If `no-auth` is not included, all SOCKS4 connections will be
     * rejected (as they do not support authentication).
     *
     * The supported methods are:
     * - `no-auth`: Standard no-authentication-required method (0x00)
     * - `custom-metadata`: Custom method (0xDA), which doesn't authenticate
     *   but allows the client to send 2-byte-length-prefixed arbitrary JSON
     *   metadata to the server, which will be associated with all
     *   requests sent on this connection. The server will respond with
     *   0x05 0x00 for 'success' after the metadata is received, or
     *   0x05 0x01 for a general failure, or 0x05 0xDA plus a 2-byte-length-prefixed
     *   JSON error with a `message` field in other cases. The only currently
     *   exposed metadata is the `tags` field, if provided here. The `mockttpParams`
     *   field in this metadata is reserved for future use.
     * - `user-password-metadata`: Use standard username/password authentication
     *   method (0x02) to smuggle metadata - this does not really authenticate the
     *   user. The username must be `metadata` and the password
     *   must be a JSON object of up to 255 chars in total. All other usernames
     *   & passwords will be rejected. This metadata is used just like
     *   `custom-metadata` but this is compatible with existing SOCKS clients.
     *   This is still less preferable due to possible client confusion and
     *   the 255 character limit.
     */
    authMethods?: Array<keyof typeof AUTH_METHODS>;
}
export type SocksTcpAddress = {
    type: 'hostname';
    hostname: string;
    port: number;
} | {
    type: 'ipv4';
    ip: string;
    port: number;
} | {
    type: 'ipv6';
    ip: string;
    port: number;
};
interface SocksServer extends net.Server {
    on(event: 'socks-tcp-connect', cb: (socket: net.Socket, address: SocksTcpAddress) => void): this;
    on(event: 'connection', listener: (socket: net.Socket) => void): this;
    on(event: 'close', listener: () => void): this;
    on(event: 'error', listener: (err: Error) => void): this;
    on(event: string, listener: (...args: any[]) => void): this;
}
declare const AUTH_METHODS: {
    readonly 'no-auth': {
        readonly id: 0;
        readonly handler: typeof handleNoAuth;
    };
    readonly 'user-password-metadata': {
        readonly id: 2;
        readonly handler: typeof handleUsernamePasswordMetadata;
    };
    readonly 'custom-metadata': {
        readonly id: 218;
        readonly handler: typeof handleCustomMetadata;
    };
};
export declare function buildSocksServer(options: SocksServerOptions): SocksServer;
declare function handleNoAuth(): Promise<boolean>;
declare function handleCustomMetadata(socket: net.Socket): Promise<boolean>;
declare function handleUsernamePasswordMetadata(socket: net.Socket): Promise<boolean>;
export {};
//# sourceMappingURL=socks-server.d.ts.map