Download codex-rs/exec-server-protocol/src/network_policy.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/exec-server-protocol/src/network_policy.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/exec-server-protocol/src/network_policy.rs
-
curl -L -o network_policy.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/exec-server-protocol/src/network_policy.rs
2.23 kB
| use serde::Deserialize; | |
| use serde::Serialize; | |
| use crate::ProcessId; | |
| pub const NETWORK_POLICY_REQUEST_METHOD: &str = "network/policyRequest"; | |
| pub const NETWORK_POLICY_DECISION_METHOD: &str = "network/policyDecision"; | |
| pub const MAX_NETWORK_POLICY_HOST_BYTES: usize = 253; | |
| pub const MAX_NETWORK_POLICY_PROCESS_ID_BYTES: usize = 256; | |
| pub const MAX_NETWORK_POLICY_REASON_BYTES: usize = 1024; | |
| pub struct NetworkPolicyRequestParams { | |
| pub process_id: ProcessId, | |
| pub request: ExecServerNetworkPolicyRequest, | |
| } | |
| pub struct ExecServerNetworkPolicyRequest { | |
| pub protocol: ExecServerNetworkProtocol, | |
| pub host: String, | |
| pub port: u16, | |
| } | |
| /// Reports an executor-local network policy decision to its authenticated controller. | |
| pub struct NetworkPolicyDecisionNotification { | |
| pub process_id: ProcessId, | |
| pub timestamp: String, | |
| pub scope: String, | |
| pub decision: String, | |
| pub source: String, | |
| pub reason: String, | |
| pub protocol: ExecServerNetworkProtocol, | |
| pub host: String, | |
| pub port: u16, | |
| pub method: Option<String>, | |
| pub client: Option<String>, | |
| pub policy_override: bool, | |
| } | |
| pub enum ExecServerNetworkProtocol { | |
| Http, | |
| HttpsConnect, | |
| Socks5Tcp, | |
| Socks5Udp, | |
| } | |
| pub struct NetworkPolicyRequestResponse { | |
| pub decision: ExecServerNetworkPolicyDecision, | |
| } | |
| pub enum ExecServerNetworkPolicyDecision { | |
| Allow, | |
| Deny { reason: String }, | |
| Ask { reason: String }, | |
| } | |
| mod tests; | |