util

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InboundTypeWithLink = []string{"socks", "http", "mixed", "shadowsocks", "naive", "hysteria", "hysteria2", "anytls", "tuic", "vless", "trojan", "vmess"}

Functions

func B64StrToByte

func B64StrToByte(str string) ([]byte, error)

func ByteToB64Str

func ByteToB64Str(b []byte) string

func CertIsSelfSigned added in v1.5.4

func CertIsSelfSigned(pemData string) bool

CertIsSelfSigned reports whether the leaf certificate in pemData is self-signed, i.e. its signature verifies against its own public key. Only self-signed certificates should be pinned via certificate_public_key_sha256; CA-signed certificates are validated normally.

func CertPEMFromTLS added in v1.5.4

func CertPEMFromTLS(tlsConfig map[string]interface{}) string

func CertPublicKeySha256 added in v1.5.4

func CertPublicKeySha256(pemData string) string

CertPublicKeySha256 returns the base64-encoded SHA256 of the certificate's SubjectPublicKeyInfo (sing-box `certificate_public_key_sha256` / link pinSHA256).

func CertSha256Hex added in v1.5.4

func CertSha256Hex(pemData string) string

CertSha256Hex returns the lowercase hex SHA256 of the whole certificate (DER), matching `openssl x509 -fingerprint -sha256` and Clash/mihomo's `fingerprint`.

func CheckPassword added in v1.5.4

func CheckPassword(plain, stored string) bool

func FillOutJson

func FillOutJson(i *model.Inbound, hostname string) error

Fill Inbound's out_json

func GetExternalLink(url string) string

func GetExternalSub

func GetExternalSub(url string) ([]map[string]interface{}, error)

func GetHeaders

func GetHeaders(client *model.Client, updateInterval int) []string

func GetOutbound

func GetOutbound(uri string, i int) (*map[string]interface{}, string, error)

func GetTlsPing added in v1.5.4

func GetTlsPing(domain string, port string) (any, error)

GetTlsPing performs a TLS handshake against domain:port (uTLS Chrome hello, no verification -- the point is to fetch whatever certificate is served) and returns the leaf certificate's SPKI SHA256 so the UI can show/pin it.

func HashPassword added in v1.5.4

func HashPassword(plain string) (string, error)

func IsHashedPassword added in v1.5.4

func IsHashedPassword(stored string) bool

func LinkGenerator

func LinkGenerator(clientConfig json.RawMessage, i *model.Inbound, hostname string, clientRemark string) []string

func StrOrBase64Encoded

func StrOrBase64Encoded(str string) string

Function to return decoded bytes if a string is Base64 encoded

func StripServerTlsFields added in v1.5.7

func StripServerTlsFields(tls map[string]interface{}) bool

StripServerTlsFields removes server-only TLS fields from a client-facing TLS object in place and reports whether anything was removed.

Types

type LinkParam

type LinkParam struct {
	Key   string
	Value string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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