Skip to content

[init] initial implementation - #1

Merged
capcom6 merged 1 commit into
masterfrom
init/add-implementation
Jul 29, 2026
Merged

[init] initial implementation#1
capcom6 merged 1 commit into
masterfrom
init/add-implementation

Conversation

@capcom6

@capcom6 capcom6 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added/updated an Uber Fx module (httpfx) that provides configured *http.Client instances via a new Factory.
    • Introduced exported Config plus per-client Option overrides for timeouts and connection pooling.
    • Implemented proxy support (explicit proxy, ALL_PROXY, and SOCKS5), including bypass lists and validation, plus exported sentinel errors for invalid proxy/config and dial failures.
  • Documentation
    • Expanded README with proxy modes, precedence rules, and concrete examples.
  • Chores
    • Updated module path/toolchain and refreshed dependency versions.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 72387091-6387-4a16-81ea-64f4258d2da3

📥 Commits

Reviewing files that changed from the base of the PR and between 4a27acf and c17ecdd.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • README.md
  • client.go
  • config.go
  • errors.go
  • factory.go
  • go.mod
  • module.go
  • options.go
🚧 Files skipped from review as they are similar to previous changes (6)
  • config.go
  • factory.go
  • options.go
  • go.mod
  • module.go
  • client.go

Walkthrough

Introduces the httpfx package with configurable HTTP client construction, SOCKS5 and environment proxy support, bypass routing, per-client options, Fx module wiring, updated dependencies, fallback handling, and project documentation.

Changes

HTTP client module

Layer / File(s) Summary
Configuration and option contracts
config.go, errors.go, options.go
Defines proxy and connection settings, exported sentinel errors, and functional options that selectively override base configuration.
Proxy-aware client construction
client.go
Builds http.Client instances with configured transports, proxy precedence, bypass routing, and dialer integration.
Factory client creation
factory.go
Adds the client factory interface and implementation, including per-client overrides and fallback to http.DefaultClient on creation errors.
Fx wiring and project setup
module.go, go.mod, README.md
Renames and wires the Fx module, updates module dependencies, and documents setup, configuration, options, and proxy examples.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant FxModule
  participant Factory
  participant newClient
  participant HTTPTransport
  Application->>FxModule: initialize httpfx.Module()
  FxModule->>Factory: provide NewFactory(Config, Logger)
  FxModule->>Factory: call NewClient()
  Factory->>newClient: build client from Config
  newClient->>HTTPTransport: configure connections and proxy routing
  newClient-->>Factory: return *http.Client
  Factory-->>FxModule: provide *http.Client
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is generic and does not describe the specific httpfx changes in this pull request. Use a concise title that names the main change, such as adding the httpfx HTTP client module and proxy-aware factory.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client.go`:
- Around line 45-48: Update both invalid-URL error paths in factory.NewClient’s
URL parsing flow to return only the generic ErrInvalidProxyURL error, without
including rawURL or any embedded credentials; preserve error wrapping if needed
while ensuring neither path exposes the original URL.
- Around line 95-99: Update the bypass parsing loop in client.go around
perHost.AddHost to detect CIDR values with net.ParseCIDR and register
successfully parsed networks via perHost.AddNetwork, while retaining AddHost for
hostnames and literal IPs. Update the documented bypass behavior in README.md
lines 187-194 to reflect CIDR network matching; no other site changes are
required.

In `@README.md`:
- Line 119: Update the proxy configuration documentation to state the actual
precedence as ProxyURL → ProxyFromEnv → HTTPProxyURL, and document the
configuration needed to disable all proxying, including inherited environment
and HTTP proxy fallbacks when ProxyURL is cleared.
- Around line 83-87: Update the Go module setup import block in the README
example to include the standard-library time package, matching the existing
time.Second usage so the snippet compiles as shown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e58db6d-b753-401d-a8f7-425baf7dc241

📥 Commits

Reviewing files that changed from the base of the PR and between 8e97351 and c1f3a86.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • README.md
  • client.go
  • config.go
  • errors.go
  • factory.go
  • go.mod
  • module.go
  • options.go

Comment thread client.go
Comment thread client.go Outdated
Comment thread README.md
Comment thread README.md Outdated
@capcom6
capcom6 force-pushed the init/add-implementation branch 2 times, most recently from 61b9382 to 52bed96 Compare July 25, 2026 09:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
client.go (1)

84-96: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Keep cancellation in the non-ContextDialer fallback.

The callback receives ctx but discards it and calls dialer.Dial. A custom registered proxy dialer can therefore continue dialing after the request or client timeout. Use a context-aware adapter, or reject dialers that do not implement proxy.ContextDialer; x/net/proxy uses this pattern in PerHost.DialContext. (github.com)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@client.go` around lines 84 - 96, Update setTransportDialer’s
non-ContextDialer fallback to preserve cancellation from the callback’s context,
using a context-aware adapter consistent with proxy.PerHost.DialContext or
rejecting unsupported dialers; do not ignore ctx while invoking dialer.Dial.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client.go`:
- Around line 59-64: The applyEnvProxy function currently treats all
proxy.Direct returns the same way, but it needs to distinguish between absent
proxy environment variables versus present-but-broken ones. Check whether proxy
environment variables are actually set in the environment before the
proxy.FromEnvironment() call. If proxy variables are present but
proxy.FromEnvironment() returns proxy.Direct, return an error to fail closed. If
no proxy variables are set, continue with the existing nil return. Preserve the
bypass parameter handling throughout this logic.
- Around line 42-50: Add validation in the applySOCKSProxy function to check
that the parsed URL contains a non-empty hostname before attempting to construct
the proxy dialer. After the existing url.Parse error check and before the
proxy.FromURL call, validate that u.Hostname() returns a non-empty string, and
return an error wrapping ErrInvalidProxyURL if the hostname is missing or empty.
This prevents malformed SOCKS URLs like socks5:// from reaching the dialer
construction step.

In `@config.go`:
- Around line 15-17: Update the documentation comment for the Bypass field to
state that it applies when any proxy is configured, covering both explicit SOCKS
proxies and ProxyFromEnv.

In `@README.md`:
- Line 47: Update the proxy environment-variable references in the README
overview, configuration table, and example to be consistent: either document
both ALL_PROXY and all_proxy in every occurrence, or remove all_proxy from the
overview and retain only ALL_PROXY.
- Around line 15-17: Update the “Report Bug” and “Request Feature” links in
README.md to point to the repository’s issue destinations rather than its root,
using the appropriate bug-report and feature-request URLs while leaving the link
labels unchanged.

---

Nitpick comments:
In `@client.go`:
- Around line 84-96: Update setTransportDialer’s non-ContextDialer fallback to
preserve cancellation from the callback’s context, using a context-aware adapter
consistent with proxy.PerHost.DialContext or rejecting unsupported dialers; do
not ignore ctx while invoking dialer.Dial.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dc6e71ab-adee-436c-b273-1ca5ece499b0

📥 Commits

Reviewing files that changed from the base of the PR and between c1f3a86 and 52bed96.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • README.md
  • client.go
  • config.go
  • errors.go
  • factory.go
  • go.mod
  • module.go
  • options.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • go.mod
  • factory.go
  • errors.go

Comment thread client.go
Comment thread client.go
Comment thread config.go
Comment thread README.md Outdated
Comment thread README.md Outdated
@capcom6
capcom6 force-pushed the init/add-implementation branch from 253a5b3 to f12dde3 Compare July 27, 2026 01:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 248: Update the README license-url reference to point to the repository’s
default master branch by replacing the current main branch segment with master,
while preserving the existing LICENSE target.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ac0eb23-a1cf-4da4-b55c-51c2fe046e7e

📥 Commits

Reviewing files that changed from the base of the PR and between 253a5b3 and f12dde3.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • README.md
  • client.go
  • config.go
  • errors.go
  • factory.go
  • go.mod
  • module.go
  • options.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • errors.go
  • go.mod
  • factory.go
  • module.go
  • options.go
  • config.go
  • client.go

Comment thread README.md Outdated
@capcom6
capcom6 force-pushed the init/add-implementation branch from 4a27acf to c17ecdd Compare July 28, 2026 02:11
@capcom6
capcom6 merged commit 4cda138 into master Jul 29, 2026
4 checks passed
@capcom6
capcom6 deleted the init/add-implementation branch July 29, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant