Repository navigation
add proxy support for realtime calls (websocket based) #5788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,7 @@ define EXPOSE_ENV | |
| fi | ||
| endef | ||
|
|
||
| .PHONY: all help dev dev-pulse build-ui build build-cli run run-cli install-air install-pulse clean test test-cli install-ui setup-workspace work-init work-clean docs docker-image docker-run cleanup-enterprise mod-tidy test-integrations-py test-integrations-ts install-playwright run-e2e run-e2e-ui run-e2e-headed run-e2e-api format ui install-newman run-provider-harness-test run-cli-harness-test test-semantic-cache test-semantic-cache-complete _test-semantic-cache-complete-inner helm-index | ||
| .PHONY: all help dev dev-pulse build-ui build build-cli run run-cli install-air install-pulse clean test test-cli install-ui setup-workspace work-init work-clean docs docker-image docker-run cleanup-enterprise mod-tidy test-integrations-py test-integrations-ts install-playwright run-e2e run-e2e-ui run-e2e-headed run-e2e-api format ui install-newman run-provider-harness-test run-cli-harness-test test-semantic-cache test-semantic-cache-complete _test-semantic-cache-complete-inner helm-index install-microsocks socks5-proxy install-tinyproxy http-proxy | ||
|
|
||
| all: help | ||
|
|
||
|
|
@@ -152,6 +152,31 @@ install-junit-viewer: ## Install junit-viewer for HTML report generation (if not | |
| $(ECHO) "$(YELLOW)CI environment detected, skipping junit-viewer installation$(NC)"; \ | ||
| fi | ||
|
|
||
| install-microsocks: ## Install microsocks SOCKS5 proxy for local testing (if not already installed) | ||
| @which microsocks > /dev/null || (command -v brew > /dev/null && $(ECHO) "$(YELLOW)Installing microsocks via Homebrew...$(NC)" && brew install microsocks) || ($(ECHO) "$(RED)Error: microsocks not found and Homebrew is unavailable. Install manually: https://github.com/rofl0r/microsocks$(NC)" && exit 1) | ||
| @$(ECHO) "$(GREEN)microsocks is ready$(NC)" | ||
|
|
||
| socks5-proxy: install-microsocks ## Run a local SOCKS5 proxy for testing provider proxy_config (Usage: make socks5-proxy [PORT=1080] [HOST=127.0.0.1]) | ||
| @PROXY_PORT=$${PORT:-1080}; \ | ||
| PROXY_HOST=$${HOST:-127.0.0.1}; \ | ||
| $(ECHO) "$(GREEN)Starting SOCKS5 proxy on $$PROXY_HOST:$$PROXY_PORT (no auth, logs each connection, Ctrl+C to stop)...$(NC)"; \ | ||
| $(ECHO) "$(YELLOW)Point a provider's proxy_config at socks5://$$PROXY_HOST:$$PROXY_PORT to test$(NC)"; \ | ||
| microsocks -i $$PROXY_HOST -p $$PROXY_PORT | ||
|
Comment on lines
+159
to
+164
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
block="$(sed -n '/^socks5-proxy:/,/^$/p' Makefile)"
if ! grep -Eq 'case .*PROXY_HOST|microsocks .*(-u|-P|-w)' <<<"$block"; then
echo "No non-loopback protection found for socks5-proxy" >&2
exit 1
fiRepository: maximhq/bifrost Length of output: 203 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- repository state ---'
git status --short
git branch --show-current
git diff --stat
printf '%s\n' '--- Makefile target context ---'
cat -n Makefile | sed -n '125,180p'
printf '%s\n' '--- related proxy targets and configuration ---'
rg -n -C 3 'socks5-proxy|microsocks|proxy_config|Allow|allowlist|SOCKS5' . \
-g '!node_modules' -g '!dist' -g '!build'
printf '%s\n' '--- stack metadata ---'
find .. -maxdepth 2 -type f \( -iname '*stack*' -o -iname '*pull*request*' \) -printRepository: maximhq/bifrost Length of output: 50374 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
log=/tmp/coderabbit-shell-logs/shell-output-xxXwlU
printf '%s\n' '--- state and target output ---'
sed -n '1,140p' "$log"
printf '%s\n' '--- exact target matches ---'
rg -n -C 8 '^socks5-proxy:|microsocks|proxy_config' Makefile README.md docs .github 2>/dev/null || true
printf '%s\n' '--- Makefile size and nearby targets ---'
wc -l Makefile
cat -n Makefile | sed -n '140,175p'
printf '%s\n' '--- changed files and stack indicators ---'
git diff --name-status
git status --short
find .. -maxdepth 2 -type f \( -iname '*stack*' -o -iname '*pull*request*' \) -printRepository: maximhq/bifrost Length of output: 50373 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- dry-run command expansion ---'
make -n socks5-proxy HOST=0.0.0.0 PORT=1080 | tail -n 8
make -n socks5-proxy HOST=192.0.2.10 PORT=1234 | tail -n 8
printf '%s\n' '--- microsocks option documentation ---'
curl -fsSL https://raw.githubusercontent.com/rofl0r/microsocks/master/README.md \
| sed -n '/^Usage/,/^$/p;/^-i /p;/^-p /p;/^-u /p;/^-P /p;/^-w /p'
printf '%s\n' '--- microsocks bind and authentication implementation ---'
curl -fsSL https://raw.githubusercontent.com/rofl0r/microsocks/master/microsocks.c \
| rg -n -C 3 'listen_ip|bind|username|password|SOCKS5_USER|SOCKS5_PASS|-i|-u|-P|-w'Repository: maximhq/bifrost Length of output: 229 🏁 Script executed: #!/usr/bin/env bash
set -u
printf '%s\n' '--- microsocks option documentation ---'
if curl -fsSL https://raw.githubusercontent.com/rofl0r/microsocks/master/README.md > /tmp/microsocks-readme; then
sed -n '/^Usage/,/^$/p;/^-i /p;/^-p /p;/^-u /p;/^-P /p;/^-w /p' /tmp/microsocks-readme
else
echo 'Unable to retrieve microsocks README' >&2
fi
printf '%s\n' '--- microsocks bind and authentication implementation ---'
if curl -fsSL https://raw.githubusercontent.com/rofl0r/microsocks/master/microsocks.c > /tmp/microsocks-c; then
rg -n -C 4 'listen_ip|bind|username|password|SOCKS5_USER|SOCKS5_PASS|getopt|case .[ipuPw]' /tmp/microsocks-c || true
else
echo 'Unable to retrieve microsocks source' >&2
fi
printf '%s\n' '--- Makefile recipe expansion by static substitution ---'
python3 - <<'PY'
from pathlib import Path
text = Path("Makefile").read_text()
start = text.index("socks5-proxy:")
end = text.index("\n\n", start)
recipe = text[start:end]
print(recipe)
print("\nFor HOST=0.0.0.0, the final command arguments are:")
print("microsocks -i 0.0.0.0 -p 1080")
PYRepository: maximhq/bifrost Length of output: 972 🌐 Web query:
💡 Result: Microsocks is a lightweight SOCKS5 server that provides command-line options for configuring its behavior, including listening address, port, authentication, and IP whitelisting [1][2]. All arguments are optional, and by default, it listens on 0.0.0.0 at port 1080 [1][3]. Below are the relevant command-line options based on the official documentation: -i listenip: Specifies the local IP address or hostname the server should listen on [2]. -p port: Sets the TCP port the server listens on [2]. -u username: Specifies the username for authentication [2]. This must be used in conjunction with the -P option [2]. -P password: Specifies the password for authentication [2]. This must be used in conjunction with the -u option [2]. -w whitelist: Allows a comma-separated list of IP addresses to use the proxy without authentication [1][2]. -1 (auth_once mode): Once a client from a specific IP address successfully authenticates with the provided username and password, that IP is added to a temporary whitelist and can subsequently use the proxy without further authentication [1][2]. This option requires both -u and -P to be specified [2]. To restrict access so that only specific whitelisted IPs can connect, users can configure an intentionally difficult or impossible-to-guess username/password combination along with the -w option [2]. For more detailed information, you can refer to the official repository at https://github.com/rofl0r/microsocks [1]. Citations:
Reject non-loopback SOCKS5 binds unless access control is configured.
🤖 Prompt for AI AgentsSource: MCP tools |
||
|
|
||
| install-tinyproxy: ## Install tinyproxy HTTP proxy for local testing (if not already installed) | ||
| @which tinyproxy > /dev/null || (command -v brew > /dev/null && $(ECHO) "$(YELLOW)Installing tinyproxy via Homebrew...$(NC)" && brew install tinyproxy) || ($(ECHO) "$(RED)Error: tinyproxy not found and Homebrew is unavailable. Install manually: https://github.com/tinyproxy/tinyproxy$(NC)" && exit 1) | ||
| @$(ECHO) "$(GREEN)tinyproxy is ready$(NC)" | ||
|
|
||
| http-proxy: install-tinyproxy ## Run a local HTTP proxy for testing provider proxy_config (Usage: make http-proxy [PORT=8888] [HOST=127.0.0.1]) | ||
| @PROXY_PORT=$${PORT:-8888}; \ | ||
| PROXY_HOST=$${HOST:-127.0.0.1}; \ | ||
| CONF=$$(mktemp -t bifrost-tinyproxy); \ | ||
| trap 'rm -f "$$CONF"' EXIT INT TERM; \ | ||
| printf 'Port %s\nListen %s\nTimeout 600\nAllow 127.0.0.1\nAllow ::1\nLogLevel Info\n' "$$PROXY_PORT" "$$PROXY_HOST" > "$$CONF"; \ | ||
| $(ECHO) "$(GREEN)Starting HTTP proxy on $$PROXY_HOST:$$PROXY_PORT (no auth, logs each connection, Ctrl+C to stop)...$(NC)"; \ | ||
| $(ECHO) "$(YELLOW)Point a provider's proxy_config at http://$$PROXY_HOST:$$PROXY_PORT to test$(NC)"; \ | ||
| tinyproxy -d -c "$$CONF" | ||
|
Comment on lines
+173
to
+178
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
for template in bifrost-tinyproxy bifrost-tinyproxy.XXXXXX; do
if path="$(mktemp -t "$template" 2>/dev/null)"; then
printf 'accepted: %s -> %s\n' "$template" "$path"
rm -f "$path"
else
printf 'rejected: %s\n' "$template"
fi
doneRepository: maximhq/bifrost Length of output: 249 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- Makefile context ---'
sed -n '145,185p' Makefile
printf '%s\n' '--- stack and working-tree summary ---'
git status --short
git branch --show-current
git log --oneline -8
printf '%s\n' '--- mktemp implementations available ---'
command -v mktemp
mktemp --version 2>/dev/null | head -n 2 || trueRepository: maximhq/bifrost Length of output: 3377 Use a portable temporary-file template and fail fast. GNU/Linux rejects 🤖 Prompt for AI AgentsSource: MCP tools |
||
|
|
||
| dev: install-ui install-air setup-workspace $(if $(DEBUG),install-delve) ## Start complete development environment (UI + API with proxy) | ||
| @$(EXPOSE_ENV); \ | ||
| set +m; \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: maximhq/bifrost
Length of output: 13974
🏁 Script executed:
Repository: maximhq/bifrost
Length of output: 11355
🏁 Script executed:
Repository: maximhq/bifrost
Length of output: 2861
🏁 Script executed:
Repository: maximhq/bifrost
Length of output: 857
🏁 Script executed:
Repository: maximhq/bifrost
Length of output: 11982
🌐 Web query:
GNU make manual command line variables exported to environment of recipe💡 Result:
In GNU Make, variables defined on the command line are automatically exported to the environment of recipes executed by Make [1][2]. When Make runs a recipe, it places variables into the environment of the shell used to execute that recipe [1][2]. Variables that originate from the command line, as well as those that were present in the environment when Make was invoked, are automatically included in this environment [1][2]. For other variables defined within the Makefile, they are only exported to the environment of recipes if they are explicitly marked with the export directive [1][2]. It is important to note that this behavior applies specifically to recipe commands [3]. Historically, the$(shell...) function did not receive these exported variables; however, as of GNU Make 4.4, all exported variables are now properly exported to the environment of the $ (shell...) function as well [4].
Citations:
🏁 Script executed:
Repository: maximhq/bifrost
Length of output: 9483
Bracket IPv6 literals in the proxy messages.
When invoked with
HOST=::1, the messages emit invalid URLs such assocks5://::1:1080. Use a display-only host that wraps IPv6 literals in[...]without changingPROXY_HOSTpassed to the proxy processes.🤖 Prompt for AI Agents
Source: MCP tools