Documentation ¶
Overview ¶
Package quicnetwork provides the quic based network.
Index ¶
- Constants
- Variables
- func CloneConfig(c *quic.Config) *quic.Config
- func EncoderFromHeader(header http.Header, encs *encoder.Encoders, enc encoder.Encoder) (encoder.Encoder, error)
- func RateLimitStoreFromURI(s string) (limiter.Store, error)
- type Channel
- func (ch *Channel) Blockdata(ctx context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
- func (ch *Channel) BlockdataMaps(ctx context.Context, heights []base.Height) ([]block.BlockdataMap, error)
- func (ch *Channel) ConnInfo() network.ConnInfo
- func (ch *Channel) EndHandover(ctx context.Context, sl network.EndHandoverSeal) (bool, error)
- func (*Channel) Initialize() error
- func (ch *Channel) NodeInfo(ctx context.Context) (network.NodeInfo, error)
- func (ch *Channel) PingHandover(ctx context.Context, sl network.PingHandoverSeal) (bool, error)
- func (ch *Channel) Proposal(ctx context.Context, h valuehash.Hash) (base.Proposal, error)
- func (ch *Channel) SendSeal(ctx context.Context, ci network.ConnInfo, sl seal.Seal) error
- func (ch *Channel) SetLogging(l *logging.Logging) *logging.Logging
- func (ch *Channel) StagedOperations(ctx context.Context, hs []valuehash.Hash) ([]operation.Operation, error)
- func (ch *Channel) StartHandover(ctx context.Context, sl network.StartHandoverSeal) (bool, error)
- type HashesArgs
- type HashesArgsUnpackerJSON
- type HeightsArgs
- type PrimitiveQuicServer
- func (qs *PrimitiveQuicServer) Handler(prefix string) *mux.Route
- func (qs *PrimitiveQuicServer) SetHandler(prefix string, handler http.Handler) *mux.Route
- func (qs *PrimitiveQuicServer) SetHandlerFunc(prefix string, f network.HTTPHandlerFunc) *mux.Route
- func (qs *PrimitiveQuicServer) SetLogging(l *logging.Logging) *logging.Logging
- func (qs *PrimitiveQuicServer) StoppedChan() <-chan struct{}
- type QuicClient
- func (cl *QuicClient) Get(ctx context.Context, timeout time.Duration, url string, b []byte, ...) (*QuicResponse, error)
- func (cl *QuicClient) Request(ctx context.Context, timeout time.Duration, url string, method string, ...) (*http.Response, func() error, error)
- func (cl *QuicClient) Send(ctx context.Context, timeout time.Duration, url string, b []byte, ...) (*QuicResponse, error)
- type QuicResponse
- type Server
- func (sv *Server) Encoder() encoder.Encoder
- func (sv *Server) Encoders() *encoder.Encoders
- func (*Server) Initialize() error
- func (sv *Server) NodeInfoHandler() network.NodeInfoHandler
- func (sv *Server) SetBlockdataHandler(fn network.BlockdataHandler)
- func (sv *Server) SetBlockdataMapsHandler(fn network.BlockdataMapsHandler)
- func (sv *Server) SetEndHandoverHandler(fn network.EndHandoverHandler)
- func (sv *Server) SetGetProposalHandler(fn network.GetProposalHandler)
- func (sv *Server) SetGetStagedOperationsHandler(fn network.GetStagedOperationsHandler)
- func (sv *Server) SetLogging(l *logging.Logging) *logging.Logging
- func (sv *Server) SetNewSealHandler(fn network.NewSealHandler)
- func (sv *Server) SetNodeInfoHandler(fn network.NodeInfoHandler)
- func (sv *Server) SetPingHandoverHandler(fn network.PingHandoverHandler)
- func (sv *Server) SetStartHandoverHandler(fn network.StartHandoverHandler)
- func (sv *Server) Start() error
Constants ¶
View Source
const QuicEncoderHintHeader string = "X-MITUM-ENCODER-HINT"
View Source
const (
SendSealFromConnInfoHeader string = "X-MITUM-FROM-CONNINFO"
)
Variables ¶
View Source
var ( HTTPClientPoolGet = func() *http.Client { return httpClientPool.Get().(*http.Client) } HTTPClientPoolPut = func(c *http.Client) { c.Transport = nil c.CheckRedirect = nil c.Jar = nil c.Timeout = 0 httpClientPool.Put(c) } RoundTripperPoolGet = func() *http3.RoundTripper { return roundTripperPool.Get().(*http3.RoundTripper) } RoundTripperPoolPut = func(r *http3.RoundTripper) { r.DisableCompression = false r.TLSClientConfig = nil r.QuicConfig = nil r.Dial = nil r.MaxResponseHeaderBytes = 0 roundTripperPool.Put(r) } )
View Source
var ( DefaultPort = "54321" QuicHandlerPathGetStagedOperations = "/operations" QuicHandlerPathSendSeal = "/seal" QuicHandlerPathGetProposal = "/proposal" QuicHandlerPathGetProposalPattern = "/proposal" + "/{hash:.*}" QuicHandlerPathGetBlockdataMaps = "/blockdatamaps" QuicHandlerPathGetBlockdata = "/blockdata" QuicHandlerPathGetBlockdataPattern = QuicHandlerPathGetBlockdata + "/{path:.*}" QuicHandlerPathPingHandoverPattern = "/handover" QuicHandlerPathStartHandoverPattern = QuicHandlerPathPingHandoverPattern + "/start" QuicHandlerPathEndHandoverPattern = QuicHandlerPathPingHandoverPattern + "/end" QuicHandlerPathNodeInfo = "/" )
View Source
var ( BadRequestError = util.NewError("bad request") NotSupportedErorr = util.NewError("not supported") )
View Source
var LimitRequestByHeights = 20 // max number of reqeust heights
Functions ¶
func CloneConfig ¶
func CloneConfig(c *quic.Config) *quic.Config
func EncoderFromHeader ¶
func RateLimitStoreFromURI ¶
Types ¶
type Channel ¶
func NewChannel ¶
func (*Channel) Blockdata ¶
func (ch *Channel) Blockdata(ctx context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
func (*Channel) BlockdataMaps ¶
func (*Channel) EndHandover ¶
func (*Channel) Initialize ¶
func (*Channel) PingHandover ¶
func (*Channel) StagedOperations ¶
func (*Channel) StartHandover ¶
type HashesArgs ¶
func NewHashesArgs ¶
func NewHashesArgs(hashes []valuehash.Hash) HashesArgs
func (HashesArgs) Sort ¶
func (ha HashesArgs) Sort()
func (HashesArgs) String ¶
func (ha HashesArgs) String() string
func (*HashesArgs) UnmarshalBSON ¶
func (ha *HashesArgs) UnmarshalBSON(b []byte) error
func (*HashesArgs) UnmarshalJSON ¶
func (ha *HashesArgs) UnmarshalJSON(b []byte) error
type HashesArgsUnpackerJSON ¶
type HeightsArgs ¶
func NewHeightsArgs ¶
func NewHeightsArgs(heights []base.Height) HeightsArgs
func (HeightsArgs) Sort ¶
func (ha HeightsArgs) Sort()
func (HeightsArgs) String ¶
func (ha HeightsArgs) String() string
type PrimitiveQuicServer ¶
type PrimitiveQuicServer struct { *logging.Logging *util.ContextDaemon // contains filtered or unexported fields }
func NewPrimitiveQuicServer ¶
func NewPrimitiveQuicServer( bind string, certs []tls.Certificate, httpLog *logging.Logging, ) (*PrimitiveQuicServer, error)
func (*PrimitiveQuicServer) Handler ¶
func (qs *PrimitiveQuicServer) Handler(prefix string) *mux.Route
func (*PrimitiveQuicServer) SetHandler ¶
func (*PrimitiveQuicServer) SetHandlerFunc ¶
func (qs *PrimitiveQuicServer) SetHandlerFunc(prefix string, f network.HTTPHandlerFunc) *mux.Route
func (*PrimitiveQuicServer) SetLogging ¶
func (qs *PrimitiveQuicServer) SetLogging(l *logging.Logging) *logging.Logging
func (*PrimitiveQuicServer) StoppedChan ¶
func (qs *PrimitiveQuicServer) StoppedChan() <-chan struct{}
type QuicClient ¶
func NewQuicClient ¶
func NewQuicClient(insecure bool, quicConfig *quic.Config) (*QuicClient, error)
type QuicResponse ¶
func NewQuicResponse ¶
func NewQuicResponse(response *http.Response, closeFunc func() error) *QuicResponse
func (*QuicResponse) Body ¶
func (qr *QuicResponse) Body() io.ReadCloser
func (*QuicResponse) Bytes ¶
func (qr *QuicResponse) Bytes() ([]byte, error)
func (*QuicResponse) Close ¶
func (qr *QuicResponse) Close() error
func (*QuicResponse) Error ¶
func (qr *QuicResponse) Error() error
func (*QuicResponse) OK ¶
func (qr *QuicResponse) OK() bool
type Server ¶
type Server struct { *logging.Logging *PrimitiveQuicServer // contains filtered or unexported fields }
func (*Server) Initialize ¶
func (*Server) NodeInfoHandler ¶
func (sv *Server) NodeInfoHandler() network.NodeInfoHandler
func (*Server) SetBlockdataHandler ¶
func (sv *Server) SetBlockdataHandler(fn network.BlockdataHandler)
func (*Server) SetBlockdataMapsHandler ¶
func (sv *Server) SetBlockdataMapsHandler(fn network.BlockdataMapsHandler)
func (*Server) SetEndHandoverHandler ¶
func (sv *Server) SetEndHandoverHandler(fn network.EndHandoverHandler)
func (*Server) SetGetProposalHandler ¶
func (sv *Server) SetGetProposalHandler(fn network.GetProposalHandler)
func (*Server) SetGetStagedOperationsHandler ¶
func (sv *Server) SetGetStagedOperationsHandler(fn network.GetStagedOperationsHandler)
func (*Server) SetNewSealHandler ¶
func (sv *Server) SetNewSealHandler(fn network.NewSealHandler)
func (*Server) SetNodeInfoHandler ¶
func (sv *Server) SetNodeInfoHandler(fn network.NodeInfoHandler)
func (*Server) SetPingHandoverHandler ¶
func (sv *Server) SetPingHandoverHandler(fn network.PingHandoverHandler)
func (*Server) SetStartHandoverHandler ¶
func (sv *Server) SetStartHandoverHandler(fn network.StartHandoverHandler)
Click to show internal directories.
Click to hide internal directories.