server

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMethod

func IsMethod(method string) bool

Types

type Context

type Context struct {
}
type Cookie struct {
	// contains filtered or unexported fields
}

func CookiesFromHeader

func CookiesFromHeader(header string) []Cookie

func NewCookie

func NewCookie(name, value string) Cookie

func (Cookie) Domain

func (c Cookie) Domain(domain string) Cookie

func (Cookie) Expires

func (c Cookie) Expires(expires time.Time) Cookie

func (Cookie) HttpOnly

func (c Cookie) HttpOnly(httpOnly bool) Cookie

func (Cookie) MaxAge

func (c Cookie) MaxAge(maxAge time.Duration) Cookie

func (Cookie) Name

func (c Cookie) Name() string

func (Cookie) Path

func (c Cookie) Path(path string) Cookie

func (Cookie) SameSite

func (c Cookie) SameSite(sameSite SameSite) Cookie

func (Cookie) Secure

func (c Cookie) Secure(secure bool) Cookie

func (Cookie) ToHeader

func (c Cookie) ToHeader() string

func (Cookie) Value

func (c Cookie) Value() string

type FormData

type FormData struct {
	Values map[string]string
	Files  map[string]struct {
		Filename string
		Data     []byte
	}
}

type Handler

type Handler func()

type Method

type Method string
const (
	M_GET     Method = "GET"
	M_HEAD    Method = "HEAD"
	M_POST    Method = "POST"
	M_PUT     Method = "PUT"
	M_DELETE  Method = "DELETE"
	M_CONNECT Method = "CONNECT"
	M_OPTIONS Method = "OPTIONS"
	M_TRACE   Method = "TRACE"
)

type Request

type Request struct {
	Method Method
	// Version string
	Host       string
	RequestURI string
	Headers    map[string]string
	FormData   FormData
	Cookies    []Cookie
	Body       []byte
}

func CreateRequest

func CreateRequest(lines []string) (*Request, error)

func (*Request) GetHeader

func (r *Request) GetHeader(name string) string

type Response

type Response struct {
}

type Route

type Route struct {
}

type Router

type Router struct {
}

type SameSite

type SameSite string
const (
	SS_LAX    SameSite = "Lax"
	SS_NONE   SameSite = "None"
	SS_STRICT SameSite = "Strict"
)

type Server

type Server struct {
	Router   *http.Handler
	Listener *net.TCPListener

	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	// contains filtered or unexported fields
}

func CreateServer

func CreateServer(address string, router *http.Handler) (*Server, error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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