routes

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const DnsMsg = "google.com."

Variables

View Source
var (
	ErrBadRequest = NewError("Body invalid")
)

Functions

func CheckDnsMsg

func CheckDnsMsg(data []byte) bool

func FileServer

func FileServer(router *chi.Mux)

func MakeDnsMsg

func MakeDnsMsg(host string) ([]byte, error)

func ParseProxiesFromClashConfig

func ParseProxiesFromClashConfig(content []byte) ([]map[string]any, error)

func ParseProxiesFromClashUrl

func ParseProxiesFromClashUrl(url string) ([]map[string]any, error)

func Start

func Start(addr string) error

func UdpTest

func UdpTest(pc net.PacketConn, target string) (bool, error)

Types

type HTTPError

type HTTPError struct {
	Message string `json:"message"`
}

HTTPError is custom HTTP error for API

func NewError

func NewError(msg string) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

type Log

type Log struct {
	UUID    uuid.UUID `json:"id"`
	Type    string    `json:"type"`
	Time    int64     `json:"time"`
	Payload string    `json:"payload"`
}

type RouterHandler

type RouterHandler func(r chi.Router)

type Status

type Status struct {
	IsStarted bool `json:"isStarted"`
}

type Traffic

type Traffic struct {
	Proxy  TrafficItem `json:"proxy"`
	Direct TrafficItem `json:"direct"`
}

type TrafficItem

type TrafficItem struct {
	Up   int64 `json:"upload"`
	Down int64 `json:"download"`
}

Jump to

Keyboard shortcuts

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