Documentation ¶
Index ¶
- Constants
- func Apis() []rpc.API
- func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string) http.Handler
- func NewVHostHandler(vhosts []string, next http.Handler) http.Handler
- func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error
- func ResultHook(r *rpc_api.Result, fileHash string) *rpc_api.Result
- func RpcLogService() *rpcLogService
- func RpcPrivApi() *rpcPrivApi
- func RpcPubApi() *rpcPubApi
- func StartHTTPEndpoint(endpoint string, timeouts rpc.HTTPTimeouts, handler http.Handler) (*http.Server, net.Addr, error)
- type HttpConfig
- type HttpServer
- func (h *HttpServer) EnableRPC(apis []rpc.API, config HttpConfig) error
- func (h *HttpServer) EnableTLS(cert, key string)
- func (h *HttpServer) EnableWS(apis []rpc.API, config WsConfig, ctx context.Context) error
- func (h *HttpServer) ListenAddr() string
- func (h *HttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *HttpServer) SetListenAddr(host string, port int) error
- func (h *HttpServer) Start(ctx context.Context) error
- func (h *HttpServer) Stop()
- type IpcServer
- type WsConfig
Constants ¶
View Source
const ( // FILE_DATA_SAFE_SIZE the length of request shall be shorter than 5242880 bytes // this equals 3932160 bytes after FILE_DATA_SAFE_SIZE = 3500000 // WAIT_TIMEOUT timeout for waiting result from external source, in seconds WAIT_TIMEOUT time.Duration = 10 * time.Second // INIT_WAIT_TIMEOUT timeout for waiting the initial request INIT_WAIT_TIMEOUT time.Duration = 15 * time.Second SIGNATURE_INFO_TTL = 10 * time.Minute UPLOAD_SLICE_LOCAL_HANDLE_TIME = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NewHTTPHandlerStack ¶
NewHTTPHandlerStack returns wrapped http-related handlers
func RegisterApis ¶
RegisterApis checks the given modules' availability, generates an allowlist based on the allowed modules, and then registers all of the APIs exposed by the services.
func RpcLogService ¶
func RpcLogService() *rpcLogService
func RpcPrivApi ¶
func RpcPrivApi() *rpcPrivApi
Types ¶
type HttpConfig ¶
type HttpConfig struct { Modules []string CorsAllowedOrigins []string Vhosts []string // contains filtered or unexported fields }
HttpConfig is the JSON-RPC/HTTP configuration.
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶
func NewHTTPServer(timeouts rpc.HTTPTimeouts) *HttpServer
func (*HttpServer) EnableRPC ¶
func (h *HttpServer) EnableRPC(apis []rpc.API, config HttpConfig) error
EnableRPC turns on JSON-RPC over HTTP on the server.
func (*HttpServer) EnableTLS ¶
func (h *HttpServer) EnableTLS(cert, key string)
func (*HttpServer) ListenAddr ¶
func (h *HttpServer) ListenAddr() string
ListenAddr returns the listening address of the server.
func (*HttpServer) ServeHTTP ¶
func (h *HttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SetListenAddr ¶
func (h *HttpServer) SetListenAddr(host string, port int) error
SetListenAddr configures the listening address of the server. The address can only be set while the server isn't running.
Click to show internal directories.
Click to hide internal directories.