httpserver

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2023 License: Apache-2.0, MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MimeTypeCar        = "application/vnd.ipld.car" // The only accepted MIME type
	MimeTypeCarVersion = "1"                        // We only accept version 1 of the MIME type
	FormatParameterCar = "car"                      // The only valid format parameter value
	FilenameExtCar     = ".car"                     // The only valid filename extension

	DefaultIncludeDupes = true // The default value for an unspecified "dups" parameter. See https://github.com/ipfs/specs/pull/412.

	ResponseAcceptRangesHeader = "none"                                // We currently don't accept range requests
	ResponseCacheControlHeader = "public, max-age=29030400, immutable" // Magic cache control values
	ResponseChunkDelimeter     = []byte("0\r\n")                       // An http/1.1 chunk delimeter, used for specifying an early end to the response
	ResponseContentTypeHeader  = fmt.Sprintf("%s; version=%s", MimeTypeCar, MimeTypeCarVersion)
)

Functions

This section is empty.

Types

type HttpServer

type HttpServer struct {
	// contains filtered or unexported fields
}

HttpServer is a Lassie server for fetching data from the network via HTTP

func NewHttpServer

func NewHttpServer(ctx context.Context, lassie *lassie.Lassie, cfg HttpServerConfig) (*HttpServer, error)

NewHttpServer creates a new HttpServer

func (HttpServer) Addr

func (s HttpServer) Addr() string

Addr returns the listening address of the server

func (*HttpServer) Close

func (s *HttpServer) Close() error

Close shutsdown the server and cancels the server context

func (*HttpServer) Start

func (s *HttpServer) Start() error

Start starts the http server, returning an error if the server failed to start

type HttpServerConfig added in v0.4.4

type HttpServerConfig struct {
	Address             string
	Port                uint
	TempDir             string
	MaxBlocksPerRequest uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL