node

package
v0.3.9-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOutbound

func NewOutbound(mamanager *Manager) *outbound

func NewSet

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

Types

type DB

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

func (*DB) Batch

func (d *DB) Batch(f func(*Node) error) error

func (*DB) Save

func (d *DB) Save() error

func (*DB) View

func (d *DB) View(f func(*Node) error) error

type HashKey

type HashKey struct{}

func (HashKey) String

func (HashKey) String() string

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 pt.TagType, hash string)

func (*Manager) Close

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

func (*Manager) DeleteNode

func (mm *Manager) DeleteNode(hash string)

func (*Manager) DeleteRemoteNodes

func (m *Manager) DeleteRemoteNodes(group string)

func (*Manager) DeleteTag

func (m *Manager) DeleteTag(tag string)

func (*Manager) ExistTag

func (m *Manager) ExistTag(tag string) (t *pt.Tags, ok bool)

func (*Manager) GetGroups

func (m *Manager) GetGroups() map[string]*node.Nodes
func (m *Manager) GetLink(name string) (*subscribe.Link, bool)
func (m *Manager) GetLinks() map[string]*subscribe.Link

func (*Manager) GetNode

func (m *Manager) GetNode(hash string) (*point.Point, bool)

func (*Manager) GetNow

func (o *Manager) GetNow(tcp bool) *point.Point

func (*Manager) GetStore

func (m *Manager) GetStore() *ProxyStore

func (*Manager) GetTags

func (m *Manager) GetTags() map[string]*pt.Tags
func (n *Manager) Links() *link

func (*Manager) Node

func (m *Manager) Node() *Nodes

func (*Manager) Outbound

func (n *Manager) Outbound() *outbound

func (*Manager) Save

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

func (*Manager) SaveNode

func (mm *Manager) SaveNode(ps ...*point.Point)

func (*Manager) Subscribe

func (f *Manager) Subscribe() *Subscribe

func (*Manager) Tag

func (f *Manager) Tag(ff func() iter.Seq[string]) gn.TagServer

func (*Manager) UsePoint

func (m *Manager) UsePoint(tcp, udp bool, hash string) error

type Node

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

func (*Node) GetManager

func (n *Node) GetManager() *node.Manager

func (*Node) GetNode

func (m *Node) GetNode(hash string) (*point.Point, bool)

func (*Node) GetNodeByName

func (m *Node) GetNodeByName(group, name string) (*point.Point, bool)

func (*Node) GetNow

func (n *Node) GetNow(tcp bool) *point.Point

func (*Node) GetUsingPoints

func (n *Node) GetUsingPoints() *list.Set[string]

type Nodes

type Nodes struct {
	gn.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 *latency.Requests) (*latency.Response, error)

func (*Nodes) List added in v0.3.8

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

func (*Nodes) Now

func (n *Nodes) Now(context.Context, *emptypb.Empty) (*gn.NowResp, error)

func (*Nodes) Remove

func (*Nodes) Save

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

func (*Nodes) Use

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

type ProxyEntry

type ProxyEntry struct {
	Proxy  netapi.Proxy
	Config *point.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 *point.Point)

type Set

type Set struct {
	netapi.EmptyDispatch

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

Set

TODO: happyeyeballs?

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)

type Subscribe

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

func (*Subscribe) Get

func (*Subscribe) Remove

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

func (*Subscribe) Save

func (*Subscribe) Update

func (s *Subscribe) Update(_ context.Context, req *gn.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