mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Allow to customise http.Transport for RPC client #1310
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U3
U3
U4
blocked
bug
bug
cli
compiler
config
config
consensus
dependencies
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
neotest
network
oracle
performance
question
rpc
security
smartcontract
task
task
task
test
vm
wallet
windows
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neo-go#1310
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fyfyrchik on GitHub (May 29, 2024).
Is your feature request related to a problem? Please describe.
The support for providing custom http.Client was removed in
nspcc-dev/neo-go@315aabde56. However, there is a number of ways one could want to customize it:net.Dialer.LocalAddr(== provide customDialContext). There are multiple lower-level solutions (bond), but they have their own problems, so I have no control over this part.rpcclient/rpc_test.gowithout usinghttptest.Server. If RPC response is an untrusted input in my threat model (e.g. I don't use mTLS), it could be necessary (i.e. following the letter of law) to fuzz my service as a blackbox.Describe the solution you'd like
Cert,KeyandCACertinrpcclient.Optionsfunc(h *http.Client)as option. Lots of ways to do this part actually, mine is an example of what will work.Describe alternatives you've considered
rpcclientcode. Quickly becomes unmaintainable.@roman-khimov commented on GitHub (May 29, 2024):
It was meant to be supported by the client natively (see
Options), but never was implemented. Same thing with server authentication. But you know that and other cases like routing really can require something more fancy. We'll think about it.@fyfyrchik commented on GitHub (Jun 11, 2024):
Turns out
func(h *http.Client)is not that flexible. For Websocket clients we need to explicitly provide some options inNewWSbecause it connects differentlynspcc-dev/neo-go@b66cea5ccc/pkg/rpcclient/wsclient.go (L456)Explicit
*tls.Configoption solves mTLS issues, but again other points in the OP require custom options.