node

package
v0.3.9-beta.11 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSet

func NewSet(nodes *node.Set, m *Manager) (netapi.Proxy, error)

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(path string) *Manager

func (*Manager) AddTag

func (m *Manager) AddTag(tag string, t node.TagType, hash string)

func (*Manager) Close

func (m *Manager) Close() error
func (m *Manager) DeleteLink(name ...string)

func (*Manager) DeleteNode

func (m *Manager) DeleteNode(hash string)

func (*Manager) DeletePublish

func (d *Manager) DeletePublish(name string)

func (*Manager) DeleteRemoteNodes

func (m *Manager) DeleteRemoteNodes(group string)

func (*Manager) DeleteTag

func (m *Manager) DeleteTag(tag string)

func (*Manager) GetGroups

func (d *Manager) GetGroups() map[string][]*api.NodesResponse_Node
func (d *Manager) GetLink(name string) (*node.Link, bool)
func (d *Manager) GetLinks() map[string]*node.Link

func (*Manager) GetNode

func (d *Manager) GetNode(hash string) (*node.Point, bool)

func (*Manager) GetNow

func (d *Manager) GetNow(tcp bool) *node.Point

func (*Manager) GetPublishes

func (d *Manager) GetPublishes() map[string]*node.Publish

func (*Manager) GetTag

func (d *Manager) GetTag(tag string) (*node.Tags, bool)

func (*Manager) GetTags

func (d *Manager) GetTags() map[string]*node.Tags

func (*Manager) GetUsingPoints

func (m *Manager) GetUsingPoints() *set.Set[string]

func (*Manager) Node

func (m *Manager) Node() *Nodes

func (*Manager) Outbound

func (m *Manager) Outbound() *Outbound

func (*Manager) Publish

func (d *Manager) Publish(name, path, password string) []*node.Point

func (*Manager) Save

func (d *Manager) Save() error
func (m *Manager) SaveLinks(links ...*node.Link)

func (*Manager) SaveNode

func (m *Manager) SaveNode(ps ...*node.Point)

func (*Manager) SavePublish

func (d *Manager) SavePublish(name string, publish *node.Publish)

func (*Manager) Store

func (m *Manager) Store() *ProxyStore

func (*Manager) Subscribe

func (m *Manager) Subscribe() *Subscribe

func (*Manager) Tag

func (m *Manager) Tag(ff func() iter.Seq[string]) api.TagServer

func (*Manager) UsePoint

func (m *Manager) UsePoint(hash string) error

type Nodes

type Nodes struct {
	api.UnimplementedNodeServer
	// contains filtered or unexported fields
}

func (*Nodes) Activates

func (*Nodes) Close

func (n *Nodes) Close(ctx context.Context, req *wrapperspb.StringValue) (*emptypb.Empty, error)

func (*Nodes) Get

func (*Nodes) Latency

func (n *Nodes) Latency(c context.Context, req *node.Requests) (*node.Response, error)

func (*Nodes) List added in v0.3.8

func (n *Nodes) List(ctx context.Context, _ *emptypb.Empty) (*api.NodesResponse, error)

func (*Nodes) Now

func (*Nodes) Remove

func (*Nodes) Save

func (n *Nodes) Save(c context.Context, p *node.Point) (*node.Point, error)

func (*Nodes) Use

func (n *Nodes) Use(c context.Context, s *api.UseReq) (*node.Point, error)

type Outbound

type Outbound struct {
	// contains filtered or unexported fields
}

func (*Outbound) Get

func (o *Outbound) Get(ctx context.Context, network string, str string, tag string) (netapi.Proxy, error)

func (*Outbound) GetDialer

func (o *Outbound) GetDialer(ctx context.Context, p *node.Point) (netapi.Proxy, error)

func (*Outbound) GetDialerByID

func (o *Outbound) GetDialerByID(ctx context.Context, hash string) (netapi.Proxy, error)

GetDialerByID if id is not exists or point dial failed, it will return nil

type ProxyEntry

type ProxyEntry struct {
	Proxy  netapi.Proxy
	Config *node.Point
	// contains filtered or unexported fields
}

ProxyEntry

TODO: first solution:

Ref counter: make sure all parent(eg: [Set]) released before proxy close
Slef update: update proxy (close and recreate) when point config changed

second solution:

check all using nodes(include [Set]) and close useless nodes

third solution:

double reference: node <-> [Set]

type ProxyStore

type ProxyStore struct {
	// contains filtered or unexported fields
}

func NewProxyStore

func NewProxyStore() *ProxyStore

func (*ProxyStore) Close

func (p *ProxyStore) Close() error

func (*ProxyStore) Delete

func (p *ProxyStore) Delete(hash string)

func (*ProxyStore) LoadOrCreate

func (p *ProxyStore) LoadOrCreate(ctx context.Context, hash string, f func() (*ProxyEntry, error)) (netapi.Proxy, error)

func (*ProxyStore) Range

func (p *ProxyStore) Range(f func(key string, value *ProxyEntry) bool)

func (*ProxyStore) Refresh

func (p *ProxyStore) Refresh(po *node.Point)

type Set

type Set struct {
	netapi.EmptyDispatch

	Nodes []string
	// contains filtered or unexported fields
}

func (*Set) Close

func (s *Set) Close() error

func (*Set) Conn

func (s *Set) Conn(ctx context.Context, addr netapi.Address) (net.Conn, error)

func (*Set) PacketConn

func (s *Set) PacketConn(ctx context.Context, addr netapi.Address) (net.PacketConn, error)

func (*Set) Ping

func (s *Set) Ping(ctx context.Context, addr netapi.Address) (uint64, error)

type Subscribe

type Subscribe struct {
	api.UnimplementedSubscribeServer
	// contains filtered or unexported fields
}

func (*Subscribe) Get

func (*Subscribe) ListPublish

func (n *Subscribe) ListPublish(ctx context.Context, in *emptypb.Empty) (*api.ListPublishResponse, error)

func (*Subscribe) Publish

func (*Subscribe) Remove

func (s *Subscribe) Remove(_ context.Context, l *api.LinkReq) (*emptypb.Empty, error)

func (*Subscribe) RemovePublish

func (n *Subscribe) RemovePublish(ctx context.Context, in *wrapperspb.StringValue) (*emptypb.Empty, error)

func (*Subscribe) Save

func (*Subscribe) SavePublish

func (n *Subscribe) SavePublish(ctx context.Context, in *api.SavePublishRequest) (*emptypb.Empty, error)

func (*Subscribe) Update

func (s *Subscribe) Update(ctx context.Context, req *api.LinkReq) (*emptypb.Empty, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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