Skip to content

feat: add UserAgentPeerProvider configuration option to Provider#60

Merged
javi11 merged 2 commits intomainfrom
feat/user-agent-peer-provider
Apr 7, 2026
Merged

feat: add UserAgentPeerProvider configuration option to Provider#60
javi11 merged 2 commits intomainfrom
feat/user-agent-peer-provider

Conversation

@javi11
Copy link
Copy Markdown
Owner

@javi11 javi11 commented Apr 7, 2026

Summary

  • Adds a UserAgentPeerProvider interface (GetUserAgent() string) to nntppool, mirroring the pattern introduced in nntpcli
  • Adds UserAgentPeerProvider UserAgentPeerProvider field to Provider struct — optional, nil-safe
  • Threads the provider through runConnSlotnewNNTPConnectionFromConnNNTPConnection, where it is stored for future use (e.g. automatic User-Agent header injection in article POSTs)

Test plan

  • TestUserAgentPeerProvider_StoredOnConnection — verifies a configured provider is stored on the connection and returns the correct string
  • TestUserAgentPeerProvider_NilIsAccepted — verifies nil is handled gracefully (no panic, field stays nil)
  • All existing tests updated to pass nil for the new parameter — make check passes clean

javi11 added 2 commits April 7, 2026 10:34
Adds a UserAgentPeerProvider interface and field to Provider, mirroring
the pattern introduced in nntpcli. The user agent string is threaded
through runConnSlot and newNNTPConnectionFromConn into NNTPConnection,
making it available for future use (e.g. article POST headers).
Replaces the UserAgentPeerProvider interface with a plain string field
Provider.UserAgent, removing unnecessary indirection since the user
agent value is static at configuration time.
@javi11 javi11 merged commit 9e746d7 into main Apr 7, 2026
1 check passed
@javi11 javi11 deleted the feat/user-agent-peer-provider branch April 7, 2026 08:47
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