endpoint

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound signals that a resolver was not found
	ErrNotFound = errors.New("not found")
)

Functions

func LookupIPv4

func LookupIPv4(endpoint string) string

Types

type BindingStore

type BindingStore = cdriver.BindingStore

type DefaultPublicKeyIDSynthesizer

type DefaultPublicKeyIDSynthesizer struct{}

func (DefaultPublicKeyIDSynthesizer) PublicKeyID

func (d DefaultPublicKeyIDSynthesizer) PublicKeyID(key any) []byte

type NetworkMember

type NetworkMember struct {
	Endpoint         string
	Metadata         []byte
	PKIid            []byte
	InternalEndpoint string
}

NetworkMember is a peer's representation

type PortName

type PortName string

PortName is the type variable for the socket ports

const (
	// ListenPort is the port at which the FSC node might listen for some service
	ListenPort PortName = "Listen"
	// ViewPort is the port on which the View Service Server respond
	ViewPort PortName = "View"
	// P2PPort is the port on which the P2P Communication Layer respond
	P2PPort PortName = "P2P"
)

type PublicKeyExtractor

type PublicKeyExtractor interface {
	// ExtractPublicKey returns the public key corresponding to the passed identity
	ExtractPublicKey(id view.Identity) (any, error)
}

PublicKeyExtractor extracts public keys from identities

type PublicKeyIDSynthesizer

type PublicKeyIDSynthesizer interface {
	PublicKeyID(any) []byte
}

type Resolver

type Resolver struct {
	ResolverInfo
	PKILock sync.RWMutex
}

Resolver wraps ResolverInfo with additional management fields

func (*Resolver) GetAddress

func (r *Resolver) GetAddress(port PortName) string

func (*Resolver) GetAddresses

func (r *Resolver) GetAddresses() map[PortName]string

func (*Resolver) GetId

func (r *Resolver) GetId() view.Identity

func (*Resolver) GetIdentity

func (r *Resolver) GetIdentity() (view.Identity, error)

func (*Resolver) GetName

func (r *Resolver) GetName() string

type ResolverInfo

type ResolverInfo struct {
	ID          []byte
	Name        string
	Domain      string
	Addresses   map[PortName]string
	AddressList []string
	Aliases     []string
	PKI         []byte
}

ResolverInfo carries information about a resolver

type Service

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

func GetService

func GetService(sp services.Provider) *Service

GetService returns an instance of the endpoint service. It panics, if no instance is found.

func NewService

func NewService(bindingKVS BindingStore) (*Service, error)

NewService returns a new instance of the view-sdk endpoint service

func (*Service) AddPublicKeyExtractor

func (r *Service) AddPublicKeyExtractor(publicKeyExtractor PublicKeyExtractor) error

func (*Service) AddResolver

func (r *Service) AddResolver(
	name string,
	domain string,
	addresses map[string]string,
	aliases []string,
	id []byte,
) (view.Identity, error)

AddResolver adds a new resolver.

func (*Service) Bind

func (r *Service) Bind(ctx context.Context, longTerm view.Identity, ephemeral view.Identity) error

func (*Service) ExtractPKI

func (r *Service) ExtractPKI(id []byte) []byte

func (*Service) GetIdentity

func (r *Service) GetIdentity(label string, pkID []byte) (view.Identity, error)

func (*Service) GetResolver

func (r *Service) GetResolver(ctx context.Context, id view.Identity) (*Resolver, error)

func (*Service) IsBoundTo

func (r *Service) IsBoundTo(ctx context.Context, a view.Identity, b view.Identity) bool

func (*Service) PkiResolve

func (r *Service) PkiResolve(resolver *Resolver) []byte

func (*Service) RemoveResolver

func (r *Service) RemoveResolver(id view.Identity) (bool, error)

RemoveResolver first check if a resolver is bound to the passed identity. If yes, the function removes the resolver. If no, the function does nothing.

func (*Service) Resolve

func (r *Service) Resolve(ctx context.Context, id view.Identity) (view.Identity, map[PortName]string, []byte, error)

Resolve returns the endpoints of the passed identity. If the passed identity does not have any endpoint set, the service checks if the passed identity is bound to another identity that is returned together with its endpoints and public-key identifier.

func (*Service) ResolveIdentities

func (r *Service) ResolveIdentities(endpoints ...string) ([]view.Identity, error)

func (*Service) Resolver

func (r *Service) Resolver(ctx context.Context, id view.Identity) (*Resolver, []byte, error)

func (*Service) Resolvers

func (r *Service) Resolvers() []ResolverInfo

func (*Service) SetPublicKeyIDSynthesizer

func (r *Service) SetPublicKeyIDSynthesizer(publicKeyIDSynthesizer PublicKeyIDSynthesizer)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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