helpers

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinGroup

func JoinGroup(c NNTPConnection, groups []string) error

JoinGroup attempts to join one of the provided groups

func VerifyProviders

func VerifyProviders(pools []ProviderPoolInterface, log Logger) error

VerifyProviders verifies that all provider pools are working correctly

Types

type ConnectionPoolInterface

type ConnectionPoolInterface interface {
	Acquire(ctx context.Context) (ConnectionResourceInterface, error)
}

ConnectionPoolInterface represents a connection pool

type ConnectionResourceInterface

type ConnectionResourceInterface interface {
	Value() ConnectionValueInterface
	Release()
}

ConnectionResourceInterface represents a pooled connection resource

type ConnectionValueInterface

type ConnectionValueInterface interface {
	GetNNTPConnection() NNTPConnection
	GetProvider() ProviderConfig
}

ConnectionValueInterface represents the actual connection value

type DialConfig

type DialConfig struct {
	KeepAliveTime time.Duration
}

DialConfig represents configuration for dialing NNTP connections

type InternalConnection

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

InternalConnection represents an internal connection with additional metadata

func NewInternalConnection

func NewInternalConnection(nntp NNTPConnection, provider ProviderConfig, leaseExpiry time.Time) *InternalConnection

NewInternalConnection creates a new internal connection

func (*InternalConnection) GetLeaseExpiry

func (ic *InternalConnection) GetLeaseExpiry() time.Time

GetLeaseExpiry returns the lease expiry time

func (*InternalConnection) GetNNTPConnection

func (ic *InternalConnection) GetNNTPConnection() NNTPConnection

GetNNTPConnection returns the NNTP connection

func (*InternalConnection) GetProvider

func (ic *InternalConnection) GetProvider() ProviderConfig

GetProvider returns the provider configuration

func (*InternalConnection) IsMarkedForReplacement

func (ic *InternalConnection) IsMarkedForReplacement() bool

IsMarkedForReplacement returns whether the connection is marked for replacement

func (*InternalConnection) SetMarkedForReplacement

func (ic *InternalConnection) SetMarkedForReplacement(marked bool)

SetMarkedForReplacement sets the replacement flag

type Logger

type Logger interface {
	Info(msg string, args ...interface{})
	Error(msg string, args ...interface{})
	Warn(msg string, args ...interface{})
	Debug(msg string, args ...interface{})
}

Logger interface for logging operations

type NNTPClient

type NNTPClient interface {
	Dial(ctx context.Context, host string, port int, config DialConfig) (NNTPConnection, error)
	DialTLS(ctx context.Context, host string, port int, insecureSSL bool, config DialConfig) (NNTPConnection, error)
}

NNTPClient interface for NNTP operations

type NNTPConnection

type NNTPConnection interface {
	Capabilities() ([]string, error)
	Authenticate(username, password string) error
	Close() error
	MaxAgeTime() time.Time
}

NNTPConnection interface for NNTP connection operations

func DialNNTP

func DialNNTP(ctx context.Context, cli NNTPClient, p ProviderConfig, log Logger) (NNTPConnection, error)

DialNNTP establishes an NNTP connection to a provider

type ProviderConfig

type ProviderConfig interface {
	ID() string
	GetHost() string
	GetUsername() string
	GetPassword() string
	GetPort() int
	GetMaxConnections() int
	GetMaxConnectionIdleTimeInSeconds() int
	GetMaxConnectionTTLInSeconds() int
	GetTLS() bool
	GetInsecureSSL() bool
	GetIsBackupProvider() bool
	GetVerifyCapabilities() []string
}

ProviderConfig represents the configuration for a single provider

type ProviderPoolInterface

type ProviderPoolInterface interface {
	GetConnectionPool() ConnectionPoolInterface
	GetProvider() ProviderConfig
}

ProviderPoolInterface represents a provider's connection pool

Jump to

Keyboard shortcuts

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