adapter

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuleGroupTypeReject = "reject"
	RuleGroupTypeDirect = "direct"
)

规则组类型常量

View Source
const (
	RelayModeAll    = "all"
	RelayModeRandom = "random"
)

中继模式常量

Variables

View Source
var (
	AutoSelect = "Auto - UrlTest"
)
View Source
var TemplateFS embed.FS

Functions

func RemoveEmptyString

func RemoveEmptyString(arr []string) []string

RemoveEmptyString 切片去除空值

func SortGroups

func SortGroups(groups []proxy.Group, nodes []string, tags map[string][]string, defaultName string) []proxy.Group

SortGroups sorts the provided slice of proxy groups by their names

Types

type Adapter

type Adapter struct {
	proxy.Adapter
}

func NewAdapter

func NewAdapter(cfg *Config) *Adapter

func (*Adapter) BuildClash

func (m *Adapter) BuildClash(uuid string) ([]byte, error)

BuildClash generates a Clash configuration for the given UUID

func (*Adapter) BuildGeneral

func (m *Adapter) BuildGeneral(uuid string) []byte

BuildGeneral generates a general configuration for the given UUID

func (*Adapter) BuildLoon

func (m *Adapter) BuildLoon(uuid string) []byte

BuildLoon generates a Loon configuration for the given UUID

func (*Adapter) BuildQuantumultX

func (m *Adapter) BuildQuantumultX(uuid string) string

BuildQuantumultX generates a Quantumult X configuration for the given UUID

func (*Adapter) BuildShadowrocket

func (m *Adapter) BuildShadowrocket(uuid string, userInfo shadowrocket.UserInfo) []byte

func (*Adapter) BuildSingbox

func (m *Adapter) BuildSingbox(uuid string) ([]byte, error)

BuildSingbox generates a Singbox configuration for the given UUID

func (*Adapter) BuildSurfboard

func (m *Adapter) BuildSurfboard(siteName string, user surfboard.UserInfo) []byte

BuildSurfboard generates a Surfboard configuration for the given site name and user info

func (*Adapter) BuildSurge

func (m *Adapter) BuildSurge(siteName string, user surge.UserInfo) []byte

BuildSurge generates a Surge configuration for the given UUID and site name

func (*Adapter) BuildV2rayN

func (m *Adapter) BuildV2rayN(uuid string) []byte

BuildV2rayN generates a V2rayN configuration for the given UUID

type Config

type Config struct {
	Nodes []*Server
	Rules []*RuleGroup
	Tags  map[string][]*Server
}

type NodeRelay

type NodeRelay struct {
	Host   string `json:"host"`
	Port   int    `json:"port"`
	Prefix string `json:"prefix"`
}

NodeRelay 节点中继

type RuleGroup

type RuleGroup struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Content  string `json:"content"`
	Behavior string `json:"behavior"`
	Rules    string `json:"rules"`
	Tags     string `json:"tags"`
	Default  bool   `json:"default"`
}

RuleGroup 规则组

type Server

type Server struct {
	ID         int64  `json:"id"`
	Name       string `json:"name"`
	Host       string `json:"host"`
	Port       int    `json:"port"`
	Protocol   string `json:"protocol"`
	Config     string `json:"config"`
	Status     bool   `json:"status"`
	Tags       string `json:"tags"`
	Country    string `json:"country"`
	RelayMode  string `json:"relay_mode"`
	RelayNode  string `json:"relay_node"`
	ServerAddr string `json:"server_addr"`
}

Server 服务器信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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