aria2-rpc 0.2.2

Remote control server for aria2-rust: JSON-RPC 2.0, XML-RPC, and WebSocket download management with 34+ methods and 7 event types
Documentation
// RPC server defaults
pub const DEFAULT_RPC_HOST: &str = "127.0.0.1";
pub const DEFAULT_RPC_PORT: u16 = 6800;
pub const RPC_SERVER_NAME: &str = "aria2-rust";

// CORS defaults (CORS_ALLOW_METHODS, CORS_ALLOW_HEADERS, CORS_MAX_AGE are in aria2-core)
pub const CORS_DEFAULT_ORIGIN: &str = "*";

// WebSocket defaults
pub const WS_DEFAULT_PING_INTERVAL_SECS: u64 = 30;
pub const WS_DEFAULT_PONG_TIMEOUT_SECS: u64 = 60;

// JSON-RPC
pub const JSON_RPC_VERSION: &str = "2.0";
pub const JSON_RPC_PARSE_ERROR: i64 = -32700;
pub const JSON_RPC_INVALID_REQUEST: i64 = -32600;
pub const JSON_RPC_METHOD_NOT_FOUND: i64 = -32601;
pub const JSON_RPC_INVALID_PARAMS: i64 = -32602;
pub const JSON_RPC_INTERNAL_ERROR: i64 = -32603;
pub const JSON_RPC_UNAUTHORIZED: i64 = -32001;

// Session/GID
pub const SESSION_ID_PREFIX: &str = "session-";
pub const GID_HEX_DIGITS: usize = 16;

// RPC endpoint
pub const RPC_ENDPOINT_PATH: &str = "/jsonrpc";

// WebSocket event names
pub const WS_EVENT_DOWNLOAD_START: &str = "aria2.onDownloadStart";
pub const WS_EVENT_DOWNLOAD_PAUSE: &str = "aria2.onDownloadPause";
pub const WS_EVENT_DOWNLOAD_STOP: &str = "aria2.onDownloadStop";
pub const WS_EVENT_DOWNLOAD_COMPLETE: &str = "aria2.onDownloadComplete";
pub const WS_EVENT_DOWNLOAD_ERROR: &str = "aria2.onDownloadError";
pub const WS_EVENT_BT_CACHE_CHANGED: &str = "aria2.onBtCacheChanged";
pub const WS_EVENT_BT_DOWNLOAD_COMPLETE: &str = "aria2.onBtDownloadComplete";
pub const WS_EVENT_BT_DOWNLOAD_ERROR: &str = "aria2.onBtDownloadError";
pub const WS_EVENT_DOWNLOAD_RESUME: &str = "aria2.onDownloadResume";