link

package
v0.0.0-...-c1e9cd8 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mywsip uint64
)
View Source
var (
	NodesList *nodes.Nodes
)

Functions

func AddDirectConn

func AddDirectConn(to uint64, host string, ent string, name string, delay uint64, mask uint64, conn *websocket.Conn)

func DelConn

func DelConn(wsip uint64)

func Forward

func Forward(to uint64, ip *ip64.Ip64) ([]byte, error)

func InitEntry

func InitEntry(nps string, ent string, hostname string, mask uint64)

InitEntry 初始化 ws entry, nps 形如 ws://xxx/nps

func InitLink(url string, adviceip uint64, isfirst bool) (uint64, int64, error)

InitLink 初始化连接 返回 wsip delay error, url 必须以 ws:// 开头, 以 ent 结尾, adviceip 可为 0

func ListenAccess

func ListenAccess(port uint16) error

func LoadNodes

func LoadNodes(nodesfile string) error

func NotifyChange

func NotifyChange(n *nodes.Nodes)

add: full host+entry; del: host+null entry

func Register

func Register() error

func SaveNodes

func SaveNodes(nodesfile string) error

func SaveNodesBack

func SaveNodesBack() error

func Send

func Send(to uint64, data *[]byte, proto uint16, srcport uint16, destport uint16) ([]byte, error)

func SendHello

func SendHello(to uint64, conn *websocket.Conn) ([]byte, error)

SendHello 从自身发送 hello 给对方,链接要靠 sendhello 保持交互,同时注册下一个 listen 函数

func SendNewNodes

func SendNewNodes(newnodes *nodes.Nodes)
func UpgradeLink(w http.ResponseWriter, r *http.Request, adviceip uint64) (uint64, int64, error)

UpgradeLink 直接从 http 请求升级连接

Types

This section is empty.

Jump to

Keyboard shortcuts

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