api

package
v0.0.0-...-64157c0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CurrentIPv4 string
	CurrentIPv6 string

	StreamData Stream
)

Functions

func CheckDomain

func CheckDomain(host string, port string) (bool, string)

func CheckIP

func CheckIP(name net.Addr) (bool, error)

func GetIP

func GetIP(url string) (net.IP, error)

func Load

func Load(name string) error

func Run

func Run()

func UpdateIPv4

func UpdateIPv4() error

func UpdateIPv6

func UpdateIPv6() error

func UpdateRule

func UpdateRule() error

Types

type PortRule

type PortRule struct {
	Port int    `json:"port"`
	Addr string `json:"addr"`
}

type Rule

type Rule struct {
	Type string `json:"type"`
	Host string `json:"host"`
}

func (*Rule) Search

func (r *Rule) Search(name string) bool

type Stream

type Stream struct {
	API    StreamAPI    `json:"api"`
	DNS    StreamDNS    `json:"dns"`
	TCP    StreamTCP    `json:"tcp"`
	Out    StreamOut    `json:"out"`
	Rule   []StreamRule `json:"rules"`
	List   []string     `json:"whitelist"`
	Strict bool         `json:"strict"`
}

type StreamAPI

type StreamAPI struct {
	Listen string   `json:"listen"`
	Secret []string `json:"secret"`
	IPv4   string   `json:"ipv4"`
	IPv6   string   `json:"ipv6"`
}

type StreamDNS

type StreamDNS struct {
	Strict   bool   `json:"strict"`
	Listen   string `json:"listen"`
	Upstream string `json:"upstream"`
}

type StreamOut

type StreamOut struct {
	Network string `json:"network"`
}

type StreamRule

type StreamRule struct {
	URL     string     `json:"url"`
	Mapping []PortRule `json:"mapping"`
	List    []Rule     `json:"-"`
}

func (*StreamRule) Outbound

func (r *StreamRule) Outbound(name string) string

func (*StreamRule) Search

func (r *StreamRule) Search(host string, port string) (bool, string)

func (*StreamRule) Update

func (r *StreamRule) Update() error

type StreamTCP

type StreamTCP struct {
	TLS  []string `json:"tls"`
	HTTP []string `json:"http"`
}

Jump to

Keyboard shortcuts

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