Interface SocksServerOptions

interface SocksServerOptions {
    authMethods?: ("no-auth" | "user-password-metadata" | "custom-metadata")[];
}

Properties

Properties

authMethods?: ("no-auth" | "user-password-metadata" | "custom-metadata")[]

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.