webserver

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//Module di injector
	Module = application.Modules{
		routes.NewRouter,
		WebAdapter,
		New,
	}
	//Config di injector
	Config = application.Modules{
		&WebConfig{},
		&MiddlewareConfig{},
	}
)

Functions

func WebAdapter added in v1.4.0

func WebAdapter(c *WebConfig, r *routes.Router) (*web.Server, *debug.Debug)

Types

type AdblockActiveModel added in v1.4.0

type AdblockActiveModel struct {
	Domain string `json:"domain"`
	Active bool   `json:"active"`
}

func (AdblockActiveModel) MarshalEasyJSON added in v1.4.0

func (v AdblockActiveModel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AdblockActiveModel) MarshalJSON added in v1.4.0

func (v AdblockActiveModel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AdblockActiveModel) UnmarshalEasyJSON added in v1.4.0

func (v *AdblockActiveModel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AdblockActiveModel) UnmarshalJSON added in v1.4.0

func (v *AdblockActiveModel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AdblockDomainModel added in v1.4.0

type AdblockDomainModel struct {
	Tag    string `json:"tag"`
	Domain string `json:"domain"`
	Active bool   `json:"active"`
}

func (AdblockDomainModel) MarshalEasyJSON added in v1.4.0

func (v AdblockDomainModel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AdblockDomainModel) MarshalJSON added in v1.4.0

func (v AdblockDomainModel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AdblockDomainModel) UnmarshalEasyJSON added in v1.4.0

func (v *AdblockDomainModel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AdblockDomainModel) UnmarshalJSON added in v1.4.0

func (v *AdblockDomainModel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AdblockURIModel added in v1.4.0

type AdblockURIModel struct {
	Tag    string `json:"tag"`
	URI    string `json:"uri"`
	Active bool   `json:"active"`
}

func (AdblockURIModel) MarshalEasyJSON added in v1.4.0

func (v AdblockURIModel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AdblockURIModel) MarshalJSON added in v1.4.0

func (v AdblockURIModel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AdblockURIModel) UnmarshalEasyJSON added in v1.4.0

func (v *AdblockURIModel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AdblockURIModel) UnmarshalJSON added in v1.4.0

func (v *AdblockURIModel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BlockDomainModel added in v1.4.0

type BlockDomainModel struct {
	Domain string `json:"domain"`
}

func (BlockDomainModel) MarshalEasyJSON added in v1.4.0

func (v BlockDomainModel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BlockDomainModel) MarshalJSON added in v1.4.0

func (v BlockDomainModel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BlockDomainModel) UnmarshalEasyJSON added in v1.4.0

func (v *BlockDomainModel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BlockDomainModel) UnmarshalJSON added in v1.4.0

func (v *BlockDomainModel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CacheList added in v1.4.0

type CacheList []CacheListItem

func (CacheList) MarshalEasyJSON added in v1.4.0

func (v CacheList) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CacheList) MarshalJSON added in v1.4.0

func (v CacheList) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CacheList) UnmarshalEasyJSON added in v1.4.0

func (v *CacheList) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CacheList) UnmarshalJSON added in v1.4.0

func (v *CacheList) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CacheListItem added in v1.4.0

type CacheListItem struct {
	Domain string   `json:"domain"`
	IP     []string `json:"ip"`
	TTL    string   `json:"ttl"`
}

func (CacheListItem) MarshalEasyJSON added in v1.4.0

func (v CacheListItem) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CacheListItem) MarshalJSON added in v1.4.0

func (v CacheListItem) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CacheListItem) UnmarshalEasyJSON added in v1.4.0

func (v *CacheListItem) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CacheListItem) UnmarshalJSON added in v1.4.0

func (v *CacheListItem) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ConfigItem

type ConfigItem struct {
	Throttling int64 `yaml:"throttling"`
}

ConfigItem model

type FixedList added in v1.4.0

type FixedList []FixedListItem

func (FixedList) MarshalEasyJSON added in v1.4.0

func (v FixedList) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FixedList) MarshalJSON added in v1.4.0

func (v FixedList) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FixedList) UnmarshalEasyJSON added in v1.4.0

func (v *FixedList) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FixedList) UnmarshalJSON added in v1.4.0

func (v *FixedList) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FixedListItem added in v1.4.0

type FixedListItem struct {
	Types  string `json:"types"`
	Origin string `json:"origin"`
	Domain string `json:"domain"`
	IPs    string `json:"ips"`
	Active bool   `json:"active"`
}

func (FixedListItem) MarshalEasyJSON added in v1.4.0

func (v FixedListItem) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FixedListItem) MarshalJSON added in v1.4.0

func (v FixedListItem) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FixedListItem) UnmarshalEasyJSON added in v1.4.0

func (v *FixedListItem) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FixedListItem) UnmarshalJSON added in v1.4.0

func (v *FixedListItem) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MiddlewareConfig

type MiddlewareConfig struct {
	Middleware ConfigItem `yaml:"middleware"`
}

MiddlewareConfig model

type WebConfig added in v1.3.0

type WebConfig struct {
	Http  servers.Config `yaml:"http"`
	Debug servers.Config `yaml:"debug"`
}

WebConfig model

type WebServer added in v1.4.0

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

WebServer model

func New added in v1.3.0

func New(route *routes.Router, conf *MiddlewareConfig, repo *cache.Repository,
	rules *rules.Repository, db *database.Database, cli *dnscli.Client) *WebServer

func (*WebServer) AdblockActive added in v1.4.0

func (v *WebServer) AdblockActive(w http.ResponseWriter, r *http.Request)

func (*WebServer) AdblockDomainList added in v1.4.0

func (v *WebServer) AdblockDomainList(w http.ResponseWriter, r *http.Request)

func (*WebServer) AdblockURIList added in v1.4.0

func (v *WebServer) AdblockURIList(w http.ResponseWriter, r *http.Request)

func (*WebServer) BlockDomain added in v1.4.0

func (v *WebServer) BlockDomain(w http.ResponseWriter, r *http.Request)

func (*WebServer) CacheList added in v1.4.0

func (v *WebServer) CacheList(w http.ResponseWriter, r *http.Request)

func (*WebServer) Down added in v1.4.0

func (v *WebServer) Down() error

Down shutdown api service

func (*WebServer) FixedActive added in v1.4.0

func (v *WebServer) FixedActive(w http.ResponseWriter, r *http.Request)

func (*WebServer) FixedDelete added in v1.4.0

func (v *WebServer) FixedDelete(w http.ResponseWriter, r *http.Request)

func (*WebServer) FixedList added in v1.4.0

func (v *WebServer) FixedList(w http.ResponseWriter, r *http.Request)

func (*WebServer) FixedSave added in v1.4.0

func (v *WebServer) FixedSave(w http.ResponseWriter, r *http.Request)

func (*WebServer) Index added in v1.4.0

func (v *WebServer) Index(w http.ResponseWriter, r *http.Request)

func (*WebServer) RegisterAPI added in v1.4.0

func (v *WebServer) RegisterAPI()

func (*WebServer) RegisterUI added in v1.4.0

func (v *WebServer) RegisterUI()

func (*WebServer) Static added in v1.4.0

func (v *WebServer) Static(w http.ResponseWriter, r *http.Request)

Static controller

func (*WebServer) Up added in v1.4.0

func (v *WebServer) Up() error

Up startup api service

Jump to

Keyboard shortcuts

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