clashapi

package
v0.0.0-...-890cd7e Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-2.0 Imports: 39 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")
	ErrServerError    = newError("Server error")
)

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

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

func (s *Server) CacheFile() adapter.ClashCacheFile

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

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

func (s *Server) Start() error

func (*Server) StoreFakeIP

func (s *Server) StoreFakeIP() bool

func (*Server) StoreSelected

func (s *Server) StoreSelected() bool

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