clashapi

package
v1.11.4 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: GPL-2.0 Imports: 42 Imported by: 7

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, logFactory log.ObservableFactory, options option.ClashAPIOptions) (adapter.ClashServer, error)

Types

type Dir added in v1.11.4

type Dir http.Dir

func (Dir) Open added in v1.11.4

func (d Dir) Open(name string) (http.File, error)

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) Name added in v1.11.0

func (s *Server) Name() string

func (*Server) RoutedConnection

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

func (*Server) RoutedPacketConnection

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

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(stage adapter.StartStage) 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