clashapi

package
v1.10.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: GPL-2.0 Imports: 42 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CtxKeyProxyName    = contextKey("proxy name")
	CtxKeyProviderName = contextKey("provider name")
	CtxKeyProxy        = contextKey("proxy")
	CtxKeyProvider     = contextKey("provider")
)
View Source
var (
	ErrUnauthorized   = newError("Unauthorized")
	ErrBadRequest     = newError("Body invalid")
	ErrForbidden      = newError("Forbidden")
	ErrNotFound       = newError("Resource not found")
	ErrRequestTimeout = newError("Timeout")
)

Functions

func NewServer

func NewServer(ctx context.Context, router adapter.Router, logFactory log.ObservableFactory, options option.ClashAPIOptions) (adapter.ClashServer, error)

Types

type HTTPError

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

HTTPError is custom HTTP error for API

func (*HTTPError) Error

func (e *HTTPError) Error() string

type Log

type Log struct {
	Type    string `json:"type"`
	Payload string `json:"payload"`
}

type Memory added in v1.3.0

type Memory struct {
	Inuse   uint64 `json:"inuse"`
	OSLimit uint64 `json:"oslimit"` // maybe we need it in the future
}

type PatchScriptRequest

type PatchScriptRequest struct {
	Script string `json:"script"`
}

type Rule

type Rule struct {
	Type    string `json:"type"`
	Payload string `json:"payload"`
	Proxy   string `json:"proxy"`
}

type Server

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

func (*Server) Close

func (s *Server) Close() error

func (*Server) HistoryStorage added in v1.1.0

func (s *Server) HistoryStorage() *urltest.HistoryStorage

func (*Server) Mode added in v1.1.0

func (s *Server) Mode() string

func (*Server) ModeList added in v1.4.0

func (s *Server) ModeList() []string

func (*Server) PreStart added in v1.2.0

func (s *Server) PreStart() error

func (*Server) RoutedConnection

func (s *Server) RoutedConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, matchedRule adapter.Rule) (net.Conn, adapter.Tracker)

func (*Server) RoutedPacketConnection

func (s *Server) RoutedPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext, matchedRule adapter.Rule) (N.PacketConn, adapter.Tracker)

func (*Server) SetMode added in v1.4.0

func (s *Server) SetMode(newMode string)

func (*Server) SetModeUpdateHook added in v1.4.0

func (s *Server) SetModeUpdateHook(hook chan<- struct{})

func (*Server) Start

func (s *Server) Start() error

func (*Server) TrafficManager added in v1.3.3

func (s *Server) TrafficManager() *trafficontrol.Manager

type Traffic

type Traffic struct {
	Up   int64 `json:"up"`
	Down int64 `json:"down"`
}

type UpdateProxyRequest

type UpdateProxyRequest struct {
	Name string `json:"name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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