core

package
v1.3.5-0...-a02a730 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetWildcardHost

func GetWildcardHost(host string) ([]string, error)

func Serve

func Serve(cfg *Config)

Config is the configuration of lighthouse

Types

type Config

type Config struct {
	Title   string `config:"title"`
	Version string `config:"version"`
	Author  string `config:"author"`
	Server  struct {
		Host string `config:"host"`
		Port int64  `config:"port"`
	} `config:"server"`
	Upstreams []string `config:"upstreams"`
	Cache     struct {
		Engine string `config:"engine,default=memory"`
		MaxAge int64  `config:"max_age"`
		Config struct {
			Host     string `config:"host"`
			Port     int64  `config:"port"`
			Db       int64  `config:"db"`
			Password string `config:"password"`
			Prefix   string `config:"prefix"`
		} `config:"config"`
	} `config:"cache"`
	Log struct {
		Transport string `config:"transport"`
		Level     string `config:"level"`
	} `config:"log"`
	Hosts struct {
		Enable bool   `config:"enable"`
		File   string `config:"file"`
	} `config:"hosts"`
	Web cc.Config `config:"web"`
}

Config is the configuration of lighthouse

type IPS

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

IPS is the IPs manager

func NewIPS

func NewIPS(cfg *Config) *IPS

NewIPS creates a new IPS

func (*IPS) ClearCache

func (i *IPS) ClearCache()

func (*IPS) GetByExactHost

func (i *IPS) GetByExactHost(host string, typ int) ([]string, error)

GetByHost returns the IPs of the extract host

func (*IPS) GetByWildcardHost

func (i *IPS) GetByWildcardHost(host string, typ int) ([]string, error)

GetByWildcardHost returns the IPs of the wildcard host

func (*IPS) SearchByHost

func (i *IPS) SearchByHost(host string, typ int) ([]string, error)

SearchByHost returns the IPs of host

func (*IPS) SetCache

func (i *IPS) SetCache(host string, ips []string)

@TODO IPv4 only

Jump to

Keyboard shortcuts

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