mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-26 12:52:57 +00:00
* simv2: wip * simulation: exec adapter start/stop * simulation: add node status to exec adapter * simulation: initial simulation code * simulation: exec adapter, configure path to executable * simulation: initial docker adapter * simulation: wip kubernetes adapter * simulation: kubernetes adapter proxy * simulation: implement GetAll/StartAll/StopAll * simulation: kuberentes adapter - set env vars and resource limits * simulation: discovery test * simulation: remove port definitions within docker adapter * simulation: simplify wait for healthy loop * simulation: get nat ip addr from interface * simulation: pull docker images automatically * simulation: NodeStatus -> NodeInfo * simulation: move discovery test to example dir * simulation: example snapshot usage * simulation: add goclient specific simulation * simulation: add peer connections to snapshot * simulation: close rpc client * simulation: don't export kubernetes proxy server * simulation: merge simulation code * simulation: don't export nodemap * simulation: rename SimulationSnapshot -> Snapshot * simulation: linting fixes * simulation: add k8s available helper func * simulation: vendor * simulation: fix 'no non-test Go files' when building * simulation: remove errors from interface methods where non were returned * simulation: run getHealthInfo check in parallel
29 lines
857 B
Go
29 lines
857 B
Go
// Package sockets provides helper functions to create and configure Unix or TCP sockets.
|
|
package sockets
|
|
|
|
import (
|
|
"errors"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
const defaultTimeout = 10 * time.Second
|
|
|
|
// ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system.
|
|
var ErrProtocolNotAvailable = errors.New("protocol not available")
|
|
|
|
// ConfigureTransport configures the specified Transport according to the
|
|
// specified proto and addr.
|
|
// If the proto is unix (using a unix socket to communicate) or npipe the
|
|
// compression is disabled.
|
|
func ConfigureTransport(tr *http.Transport, proto, addr string) error {
|
|
switch proto {
|
|
case "unix":
|
|
return configureUnixTransport(tr, proto, addr)
|
|
case "npipe":
|
|
return configureNpipeTransport(tr, proto, addr)
|
|
default:
|
|
tr.Proxy = http.ProxyFromEnvironment
|
|
}
|
|
return nil
|
|
}
|