Documentation
¶
Index ¶
- func JoinGroup(c NNTPConnection, groups []string) error
- func VerifyProviders(pools []ProviderPoolInterface, log Logger) error
- type ConnectionPoolInterface
- type ConnectionResourceInterface
- type ConnectionValueInterface
- type DialConfig
- type InternalConnection
- func (ic *InternalConnection) GetLeaseExpiry() time.Time
- func (ic *InternalConnection) GetNNTPConnection() NNTPConnection
- func (ic *InternalConnection) GetProvider() ProviderConfig
- func (ic *InternalConnection) IsMarkedForReplacement() bool
- func (ic *InternalConnection) SetMarkedForReplacement(marked bool)
- type Logger
- type NNTPClient
- type NNTPConnection
- type ProviderConfig
- type ProviderPoolInterface
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 ¶
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