export const PROTOCOL_VERSION = 1; export const MIN_SUPPORTED_PROTOCOL = 1; export const CLIENT_KIND = "extension"; export const MODE_FETCH = "fetch"; export const ALLOWED_PORTS = Object.freeze([80, 443]); export const HTTPS_PORT = 443; export const CLOSE_NORMAL = 1000; export const CLOSE_PROTOCOL = 4400; export const CLOSE_RETRY_OWNER = 4013; export const CLOSE_CAPACITY = 4029; export const CLOSE_KICKED = 4403; export const CLOSE_POLICY = 1008; export const MAX_REDIRECTS = 5; export const MAX_RESPONSE_HEADERS = 64; export const MAX_HEADER_VALUE_CHARS = 512; export const MAX_BODY_CHUNKS = 65536; export const MAX_BACKOFF_EXPONENT = 16; export const LIMITS = Object.freeze({ max_frame_bytes: 256 * 1024, max_body_bytes: 2 * 1024 * 1024, max_concurrent_per_node: 2, job_timeout_seconds: 25, default_donor_mb_per_day: 500, max_donor_mb_per_day: 20 * 1024, ping_seconds: 20, reconnect_min_seconds: 1, reconnect_max_seconds: 60, url_max_chars: 2048, }); export const FRAME_CEILING_BYTES = Object.freeze({ job_result: 3 * 1024 * 1024, default: 256 * 1024, }); export const DESTINATIONS = Object.freeze([ Object.freeze({ suffix: "reddit.com", adapter: "reddit", methods: Object.freeze(["GET"]), ports: Object.freeze([80, 443]), modes: Object.freeze(["tunnel", "fetch"]), max_rps: 0.5, }), Object.freeze({ suffix: "redd.it", adapter: "reddit", methods: Object.freeze(["GET"]), ports: Object.freeze([80, 443]), modes: Object.freeze(["tunnel", "fetch"]), max_rps: 0.5, }), ]); export const REFUSALS = Object.freeze({ HOST_NOT_ALLOWED: "host_not_allowed", PORT_NOT_ALLOWED: "port_not_allowed", ADDRESS_NOT_PUBLIC: "address_not_public", REDIRECT_NOT_ALLOWED: "redirect_not_allowed", METHOD_NOT_ALLOWED: "method_not_allowed", BANDWIDTH_EXHAUSTED: "bandwidth_exhausted", CONCURRENCY_EXCEEDED: "concurrency_exceeded", OUTSIDE_HOURS: "outside_hours", ON_BATTERY: "on_battery", BODY_TOO_LARGE: "body_too_large", TIMEOUT: "timeout", }); export const SUSPENSION = Object.freeze({ reason: "suspended", min_seconds: 60, max_seconds: 24 * 60 * 60, default_seconds: 300, jitter_seconds: 30, }); export const FETCH_FAILED = "fetch_failed"; export const SERVER_FRAMES = Object.freeze({ welcome: Object.freeze({ device_uid: "string", limits: "object", destinations: "array", settings: "object", }), ping: Object.freeze({}), job: Object.freeze({ job_id: "string", method: "string", url: "string", timeout: "number", }), tunnel_open: Object.freeze({ conn_id: "string", host: "string", port: "number" }), tunnel_data: Object.freeze({ conn_id: "string", b64: "string" }), tunnel_close: Object.freeze({ conn_id: "string" }), settings_update: Object.freeze({ settings: "object" }), kick: Object.freeze({ reason: "string" }), }); export const DROPPED_RESPONSE_HEADERS = Object.freeze([ "set-cookie", "set-cookie2", "authorization", "proxy-authenticate", ]); export const FORWARDED_REQUEST_HEADERS = Object.freeze(["accept", "accept-language"]); export const HALTING_CLOSE_REASONS_EXEMPT = Object.freeze(["ticket", "heartbeat", "error", "capacity"]);