clientmeta

package
v0.62.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package clientmeta extracts originating-client metadata (IP, codex version, OS) from inbound HTTP requests. Used by both codex-exec-gateway (executors connecting from user laptops) and codex-app-gateway (codex --remote CLI sessions) so the Browsers + Connectors UI columns derive from identical logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(r *http.Request) string

ClientIP returns the best-effort originating client IP for an inbound HTTP request. The kube ingress chain prepends entries to X-Forwarded-For ("client, proxy1, proxy2"); the first non-empty hop is the real client. Falls back to X-Real-IP, then r.RemoteAddr (host:port) with the port stripped.

func ParseCodexUA

func ParseCodexUA(ua string) (version, osStr string)

ParseCodexUA extracts the codex CLI version and host OS from the User-Agent string of a codex client (exec-server inbound or `codex --remote` ws). Upstream codex's reqwest client sends UAs shaped like:

codex_cli_rs/0.130.0 (Darwin 24.4.0; arm64)
codex_cli_rs/0.128.0 (Linux 6.5.0-15-generic; x86_64)

We pattern-match conservatively and return ("", "") on anything we don't recognise so callers can store NULL and the UI shows "—".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL