clashapi

package
v0.0.0-...-2a1d78e Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: GPL-2.0 Imports: 42 Imported by: 0

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 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

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

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

func (*Server) Mode

func (s *Server) Mode() string

func (*Server) ModeList

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

func (*Server) Name

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

func (s *Server) SetMode(newMode string)

func (*Server) SetModeUpdateHook

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

func (*Server) Start

func (s *Server) Start(stage adapter.StartStage) error

func (*Server) TrafficManager

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