Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterOverlayServer(s *grpc.Server, srv OverlayServer)
- type Bucket
- type Client
- func (c *Client) AllPeers() []*grpc.ClientConn
- func (c *Client) Bootstrap() (results []*ID)
- func (c *Client) BucketSize() int
- func (c *Client) ClosestPeerIDs() []*ID
- func (c *Client) ClosestPeers(opts ...DialOption) []ClosestPeer
- func (c *Client) Dial(addr string, opts ...DialOption) (*grpc.ClientConn, error)
- func (c *Client) DialContext(ctx context.Context, addr string) (*grpc.ClientConn, error)
- func (c *Client) DisconnectByAddress(address string) error
- func (c *Client) FindNode(target *ID, k int, a int, d int) []*ID
- func (c *Client) ID() *ID
- func (c *Client) Keys() *Keypair
- func (c *Client) Listen(opts ...grpc.ServerOption) *grpc.Server
- func (c *Client) Logger() *log.Logger
- func (c *Client) OnPeerJoin(fn func(*grpc.ClientConn, *ID))
- func (c *Client) OnPeerLeave(fn func(*grpc.ClientConn, *ID))
- func (c *Client) Protocol() Protocol
- func (c *Client) RefreshPeriodically(stop chan struct{}, duration time.Duration)
- func (c *Client) SetCredentials(creds *noise.Credentials)
- type ClosestPeer
- type DialOption
- type FindNodeRequest
- func (*FindNodeRequest) Descriptor() ([]byte, []int)
- func (m *FindNodeRequest) GetId() []byte
- func (m *FindNodeRequest) Marshal() (dAtA []byte, err error)
- func (m *FindNodeRequest) MarshalTo(dAtA []byte) (int, error)
- func (*FindNodeRequest) ProtoMessage()
- func (m *FindNodeRequest) Reset()
- func (m *FindNodeRequest) Size() (n int)
- func (m *FindNodeRequest) String() string
- func (m *FindNodeRequest) Unmarshal(dAtA []byte) error
- func (m *FindNodeRequest) XXX_DiscardUnknown()
- func (m *FindNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FindNodeRequest) XXX_Merge(src proto.Message)
- func (m *FindNodeRequest) XXX_Size() int
- func (m *FindNodeRequest) XXX_Unmarshal(b []byte) error
- type FindNodeResponse
- func (*FindNodeResponse) Descriptor() ([]byte, []int)
- func (m *FindNodeResponse) GetIds() [][]byte
- func (m *FindNodeResponse) Marshal() (dAtA []byte, err error)
- func (m *FindNodeResponse) MarshalTo(dAtA []byte) (int, error)
- func (*FindNodeResponse) ProtoMessage()
- func (m *FindNodeResponse) Reset()
- func (m *FindNodeResponse) Size() (n int)
- func (m *FindNodeResponse) String() string
- func (m *FindNodeResponse) Unmarshal(dAtA []byte) error
- func (m *FindNodeResponse) XXX_DiscardUnknown()
- func (m *FindNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FindNodeResponse) XXX_Merge(src proto.Message)
- func (m *FindNodeResponse) XXX_Size() int
- func (m *FindNodeResponse) XXX_Unmarshal(b []byte) error
- type ID
- type InterceptedClientStream
- type InterceptedServerStream
- type Keypair
- type Option
- type OverlayClient
- type OverlayServer
- type Ping
- func (*Ping) Descriptor() ([]byte, []int)
- func (m *Ping) Marshal() (dAtA []byte, err error)
- func (m *Ping) MarshalTo(dAtA []byte) (int, error)
- func (*Ping) ProtoMessage()
- func (m *Ping) Reset()
- func (m *Ping) Size() (n int)
- func (m *Ping) String() string
- func (m *Ping) Unmarshal(dAtA []byte) error
- func (m *Ping) XXX_DiscardUnknown()
- func (m *Ping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Ping) XXX_Merge(src proto.Message)
- func (m *Ping) XXX_Size() int
- func (m *Ping) XXX_Unmarshal(b []byte) error
- type Protocol
- func (p Protocol) Client(info noise.Info, ctx context.Context, authority string, conn net.Conn) (net.Conn, error)
- func (p Protocol) DoPing(context.Context, *Ping) (*Ping, error)
- func (p Protocol) FindNode(ctx context.Context, req *FindNodeRequest) (*FindNodeResponse, error)
- func (p Protocol) Server(info noise.Info, conn net.Conn) (net.Conn, error)
- type Table
Constants ¶
View Source
const ( DefaultPrefixDiffLen = 128 DefaultPrefixDiffMin = 32 DefaultC1 = 16 DefaultC2 = 16 )
View Source
const (
KeyID = "skademlia.id"
)
Variables ¶
View Source
var ( ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRpc = fmt.Errorf("proto: integer overflow") )
View Source
var (
ErrBucketFull = errors.New("bucket is full")
)
Functions ¶
func RegisterOverlayServer ¶
func RegisterOverlayServer(s *grpc.Server, srv OverlayServer)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AllPeers ¶
func (c *Client) AllPeers() []*grpc.ClientConn
func (*Client) BucketSize ¶
func (*Client) ClosestPeerIDs ¶
func (*Client) ClosestPeers ¶
func (c *Client) ClosestPeers(opts ...DialOption) []ClosestPeer
func (*Client) Dial ¶
func (c *Client) Dial(addr string, opts ...DialOption) (*grpc.ClientConn, error)
func (*Client) DialContext ¶
func (*Client) DisconnectByAddress ¶
func (*Client) OnPeerJoin ¶
func (c *Client) OnPeerJoin(fn func(*grpc.ClientConn, *ID))
func (*Client) OnPeerLeave ¶
func (c *Client) OnPeerLeave(fn func(*grpc.ClientConn, *ID))
func (*Client) RefreshPeriodically ¶
RefreshPeriodically periodically refreshes the list of peers for a node given a time period.
func (*Client) SetCredentials ¶
func (c *Client) SetCredentials(creds *noise.Credentials)
type ClosestPeer ¶
type ClosestPeer struct { Conn *grpc.ClientConn ID *ID }
type DialOption ¶
type DialOption func(o *dialOptions)
func WithTimeout ¶
func WithTimeout(timeout time.Duration) DialOption
type FindNodeRequest ¶
type FindNodeRequest struct {
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (*FindNodeRequest) Descriptor ¶
func (*FindNodeRequest) Descriptor() ([]byte, []int)
func (*FindNodeRequest) GetId ¶
func (m *FindNodeRequest) GetId() []byte
func (*FindNodeRequest) Marshal ¶
func (m *FindNodeRequest) Marshal() (dAtA []byte, err error)
func (*FindNodeRequest) ProtoMessage ¶
func (*FindNodeRequest) ProtoMessage()
func (*FindNodeRequest) Reset ¶
func (m *FindNodeRequest) Reset()
func (*FindNodeRequest) Size ¶
func (m *FindNodeRequest) Size() (n int)
func (*FindNodeRequest) String ¶
func (m *FindNodeRequest) String() string
func (*FindNodeRequest) Unmarshal ¶
func (m *FindNodeRequest) Unmarshal(dAtA []byte) error
func (*FindNodeRequest) XXX_DiscardUnknown ¶
func (m *FindNodeRequest) XXX_DiscardUnknown()
func (*FindNodeRequest) XXX_Marshal ¶
func (m *FindNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FindNodeRequest) XXX_Merge ¶
func (m *FindNodeRequest) XXX_Merge(src proto.Message)
func (*FindNodeRequest) XXX_Size ¶
func (m *FindNodeRequest) XXX_Size() int
func (*FindNodeRequest) XXX_Unmarshal ¶
func (m *FindNodeRequest) XXX_Unmarshal(b []byte) error
type FindNodeResponse ¶
type FindNodeResponse struct {
Ids [][]byte `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"`
}
func (*FindNodeResponse) Descriptor ¶
func (*FindNodeResponse) Descriptor() ([]byte, []int)
func (*FindNodeResponse) GetIds ¶
func (m *FindNodeResponse) GetIds() [][]byte
func (*FindNodeResponse) Marshal ¶
func (m *FindNodeResponse) Marshal() (dAtA []byte, err error)
func (*FindNodeResponse) ProtoMessage ¶
func (*FindNodeResponse) ProtoMessage()
func (*FindNodeResponse) Reset ¶
func (m *FindNodeResponse) Reset()
func (*FindNodeResponse) Size ¶
func (m *FindNodeResponse) Size() (n int)
func (*FindNodeResponse) String ¶
func (m *FindNodeResponse) String() string
func (*FindNodeResponse) Unmarshal ¶
func (m *FindNodeResponse) Unmarshal(dAtA []byte) error
func (*FindNodeResponse) XXX_DiscardUnknown ¶
func (m *FindNodeResponse) XXX_DiscardUnknown()
func (*FindNodeResponse) XXX_Marshal ¶
func (m *FindNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FindNodeResponse) XXX_Merge ¶
func (m *FindNodeResponse) XXX_Merge(src proto.Message)
func (*FindNodeResponse) XXX_Size ¶
func (m *FindNodeResponse) XXX_Size() int
func (*FindNodeResponse) XXX_Unmarshal ¶
func (m *FindNodeResponse) XXX_Unmarshal(b []byte) error
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
func (ID) PublicKey ¶
func (m ID) PublicKey() edwards25519.PublicKey
type InterceptedClientStream ¶
type InterceptedClientStream struct { grpc.ClientStream // contains filtered or unexported fields }
func (InterceptedClientStream) RecvMsg ¶
func (s InterceptedClientStream) RecvMsg(m interface{}) error
func (InterceptedClientStream) SendMsg ¶
func (s InterceptedClientStream) SendMsg(m interface{}) error
type InterceptedServerStream ¶
type InterceptedServerStream struct { grpc.ServerStream // contains filtered or unexported fields }
func (InterceptedServerStream) RecvMsg ¶
func (s InterceptedServerStream) RecvMsg(m interface{}) error
func (InterceptedServerStream) SendMsg ¶
func (s InterceptedServerStream) SendMsg(m interface{}) error
type Keypair ¶
type Keypair struct {
// contains filtered or unexported fields
}
func LoadKeys ¶
func LoadKeys(privateKey edwards25519.PrivateKey, c1, c2 int) (*Keypair, error)
func (*Keypair) PrivateKey ¶
func (k *Keypair) PrivateKey() edwards25519.PrivateKey
func (*Keypair) PublicKey ¶
func (k *Keypair) PublicKey() edwards25519.PublicKey
type Option ¶
type Option func(c *Client)
func WithDialOptions ¶
func WithDialOptions(opts ...grpc.DialOption) Option
func WithPrefixDiffLen ¶
func WithPrefixDiffMin ¶
type OverlayClient ¶
type OverlayClient interface { DoPing(ctx context.Context, in *Ping, opts ...grpc.CallOption) (*Ping, error) FindNode(ctx context.Context, in *FindNodeRequest, opts ...grpc.CallOption) (*FindNodeResponse, error) }
OverlayClient is the client API for Overlay service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewOverlayClient ¶
func NewOverlayClient(cc *grpc.ClientConn) OverlayClient
type OverlayServer ¶
type OverlayServer interface { DoPing(context.Context, *Ping) (*Ping, error) FindNode(context.Context, *FindNodeRequest) (*FindNodeResponse, error) }
OverlayServer is the server API for Overlay service.
type Ping ¶
type Ping struct { }
func (*Ping) Descriptor ¶
func (*Ping) ProtoMessage ¶
func (*Ping) ProtoMessage()
func (*Ping) XXX_DiscardUnknown ¶
func (m *Ping) XXX_DiscardUnknown()
func (*Ping) XXX_Unmarshal ¶
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
func (Protocol) FindNode ¶
func (p Protocol) FindNode(ctx context.Context, req *FindNodeRequest) (*FindNodeResponse, error)
Click to show internal directories.
Click to hide internal directories.