domain

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArticleNotFound = errors.New("article not found")

ErrArticleNotFound indicates a 430 response from Usenet

View Source
var ErrProviderBusy = errors.New("all providers busy")

ErrProviderBusy indicates all nntp connections are in use

Functions

This section is empty.

Types

type Article

type Article struct {
	MessageID string
	Size      int
}

Article respresents the metadata for a single Usenet post.

type ArticleRespository

type ArticleRespository interface {
	FetchBody(messageID string) (io.Reader, error)
	Authenticate() error
	Close() error
}

ArticleRepository defines the contract for fetching data from Usenet.

type DownloadFile

type DownloadFile struct {
	Source    *NZBFile
	Segments  []NZBSegment
	CleanName string
	PartPath  string
	FinalPath string
	Size      int64
	// contains filtered or unexported fields
}

func NewDownloadFile

func NewDownloadFile(raw NZBFile, cleanName, outDir string) *DownloadFile

func (*DownloadFile) GetActualSize

func (f *DownloadFile) GetActualSize() int64

func (*DownloadFile) SetActualSize

func (f *DownloadFile) SetActualSize(size int64)

type DownloadJob

type DownloadJob struct {
	Segment    NZBSegment
	File       *DownloadFile
	Groups     []string
	Offset     int64
	RetryCount int
}

type DownloadResult

type DownloadResult struct {
	Job   DownloadJob
	Error error
}

type NZB

type NZB struct {
	XMLName xml.Name  `xml:"nzb"`
	Files   []NZBFile `xml:"file"`
}

type NZBFile

type NZBFile struct {
	Subject  string       `xml:"subject,attr"`
	Poster   string       `xml:"poster,attr"`
	Groups   []string     `xml:"groups>group"`
	Segments []NZBSegment `xml:"segments>segment"`
}

type NZBSegment

type NZBSegment struct {
	XMLName   xml.Name `xml:"segment"`
	Number    int      `xml:"number,attr"`
	Bytes     int64    `xml:"bytes,attr"`
	MessageID string   `xml:",chardata"`
}

type Provider

type Provider interface {
	ID() string
	Priority() int
	MaxConnection() int
	Fetch(ctx context.Context, msgID string, groups []string) (io.Reader, error)
	TestConnection() error
	Close() error
}

Provider represents the contract for a Usenet server connection.

type ProviderConfig

type ProviderConfig struct {
	ID            string
	Host          string
	Port          int
	Username      string
	Password      string
	TLS           bool
	MaxConnection int
	Priority      int
}

Provider is the Domain's contract for what it needs to start a provider.

type WriteRequest

type WriteRequest struct {
	FilePath string
	Offset   int64
	Data     []byte
	Done     chan error // Feedback loop for the worker
}

Jump to

Keyboard shortcuts

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