grpc

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Unlicense Imports: 10 Imported by: 0

Documentation

Overview

Package grpc provides a gRPC client that implements the acl.I interface. This allows the relay to use a remote ACL server via gRPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements the acl.I interface via gRPC.

func New

func New(ctx context.Context, cfg *ClientConfig) (*Client, error)

New creates a new gRPC ACL client.

func (*Client) AddFollow

func (c *Client) AddFollow(pubkey []byte) error

AddFollow adds a pubkey to the followed list.

func (*Client) AllowPubkey

func (c *Client) AllowPubkey(pubkey, reason string) error

AllowPubkey adds a pubkey to the allow list.

func (*Client) BanPubkey

func (c *Client) BanPubkey(pubkey, reason string) error

BanPubkey adds a pubkey to the ban list.

func (*Client) BlacklistPubkey

func (c *Client) BlacklistPubkey(pubkey, reason string) error

BlacklistPubkey adds a pubkey to the blacklist.

func (*Client) BlockIP

func (c *Client) BlockIP(ip, reason string) error

BlockIP adds an IP to the block list.

func (*Client) CheckPolicy

func (c *Client) CheckPolicy(ev *event.E) (bool, error)

func (*Client) Close

func (c *Client) Close() error

Close closes the gRPC connection.

func (*Client) Configure

func (c *Client) Configure(cfg ...any) error

func (*Client) DisallowPubkey

func (c *Client) DisallowPubkey(pubkey string) error

DisallowPubkey removes a pubkey from the allow list.

func (*Client) GetACLInfo

func (c *Client) GetACLInfo() (name, description, documentation string)

func (*Client) GetAccessLevel

func (c *Client) GetAccessLevel(pub []byte, address string) string

func (*Client) GetAdminRelays

func (c *Client) GetAdminRelays() []string

GetAdminRelays returns the admin relay URLs.

func (*Client) GetFollowedPubkeys

func (c *Client) GetFollowedPubkeys() [][]byte

GetFollowedPubkeys returns all followed pubkeys.

func (*Client) GetThrottleDelay

func (c *Client) GetThrottleDelay(pubkey []byte, ip string) time.Duration

GetThrottleDelay returns the progressive throttle delay for a pubkey.

func (*Client) IsCuratingConfigured

func (c *Client) IsCuratingConfigured() (bool, error)

IsCuratingConfigured checks if curating mode is configured.

func (*Client) RateLimitCheck

func (c *Client) RateLimitCheck(pubkey, ip string) (allowed bool, message string, err error)

RateLimitCheck checks if a pubkey/IP can publish.

func (*Client) Ready

func (c *Client) Ready() <-chan struct{}

Ready returns a channel that closes when the client is ready.

func (*Client) Syncer

func (c *Client) Syncer()

func (*Client) TrustPubkey

func (c *Client) TrustPubkey(pubkey, note string) error

TrustPubkey adds a pubkey to the trusted list.

func (*Client) Type

func (c *Client) Type() string

func (*Client) UnbanPubkey

func (c *Client) UnbanPubkey(pubkey string) error

UnbanPubkey removes a pubkey from the ban list.

func (*Client) UnblacklistPubkey

func (c *Client) UnblacklistPubkey(pubkey string) error

UnblacklistPubkey removes a pubkey from the blacklist.

func (*Client) UnblockIP

func (c *Client) UnblockIP(ip string) error

UnblockIP removes an IP from the block list.

func (*Client) UntrustPubkey

func (c *Client) UntrustPubkey(pubkey string) error

UntrustPubkey removes a pubkey from the trusted list.

func (*Client) UpdatePeerAdmins

func (c *Client) UpdatePeerAdmins(peerPubkeys [][]byte) error

UpdatePeerAdmins updates the peer relay identity pubkeys.

type ClientConfig

type ClientConfig struct {
	ServerAddress  string
	ConnectTimeout time.Duration
}

ClientConfig holds configuration for the gRPC ACL client.

Jump to

Keyboard shortcuts

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