newsrover

package module
v0.0.0-...-2476a96 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2014 License: MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadYenc error = fmt.Errorf("Only recieved bad Yencs.")

Functions

This section is empty.

Types

type Article

type Article struct {
	Group     string `json:"group"`
	ArticleId int    `json:"article_id"`
	Subject   string `json:"subject"`
	From      string `json:"from"`
	Date      string `json:"date"`
	MessageId string `json:"message_id"`
	Bytes     int64  `json:"bytes"`
}

func (Article) Pretty

func (a Article) Pretty() string

func (Article) Time

func (a Article) Time() time.Time

type FetchIter

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

func (*FetchIter) Close

func (i *FetchIter) Close() error

func (*FetchIter) Next

func (i *FetchIter) Next(outArticle *Article) bool

type Group

type Group struct {
	Name   string
	Number int
	Low    int
	High   int
}

type Part

type Part struct {
	Crc32, PartCrc32, ExpectedCrc32 uint32
	LineSize                        uint32
	TotalSize, PartSize             uint32
	Part, Total                     uint32
	Begin, End                      uint32
	Name                            string
	Body                            []byte
}

func (*Part) ValidPartCrc

func (p *Part) ValidPartCrc() bool

type Rover

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

func NewRover

func NewRover(addr string, conf RoverConfig) (*Rover, error)

func NewRoverSsl

func NewRoverSsl(addr string, conf RoverConfig) (*Rover, error)

func (*Rover) AddSink

func (r *Rover) AddSink(sink Sink)

func (*Rover) Close

func (r *Rover) Close()

func (*Rover) Do

func (r *Rover) Do(expectCode int, format string, args ...interface{}) (string, error)

func (*Rover) Fetch

func (r *Rover) Fetch(articleId ...int) ([]Article, error)

func (*Rover) FetchIter

func (r *Rover) FetchIter(articleId ...int) (*FetchIter, error)

func (*Rover) Group

func (r *Rover) Group() string

func (*Rover) ParseArticle

func (r *Rover) ParseArticle(line string) (Article, error)

func (*Rover) ReadProgress

func (r *Rover) ReadProgress() int

func (*Rover) RemoveSink

func (r *Rover) RemoveSink(sink Sink)

func (*Rover) SaveProgress

func (r *Rover) SaveProgress(article int)

func (*Rover) Serve

func (r *Rover) Serve() error

func (*Rover) SetLogger

func (r *Rover) SetLogger(logger *log.Logger)

func (*Rover) Stop

func (r *Rover) Stop()

func (*Rover) SwitchGroup

func (r *Rover) SwitchGroup(group string) (Group, error)

type RoverConfig

type RoverConfig struct {
	Host  string `json:"host"`
	SSL   bool   `json:"use_ssl"`
	Group string `json:"newsgroup"`

	AuthUser string `json:"auth_user"`
	AuthPass string `json:"auth_pass"`

	CheckEvery  int `json:"check_every"`
	FlushEvery  int `json:"flush_articles_every"`
	MaxArticles int `json:"max_buffered_articles"`

	StartAt  int    `json:"start_at_article"`
	StopAt   int    `json:"no_article_to_process"`
	Progress string `json:"progress"`
}

type Sink

type Sink interface {
	Name() string
	Accept([]Article)
	Serve()
	Stop()
	SetLogger(*log.Logger)
}

type StdSink

type StdSink struct{}

func (*StdSink) Accept

func (s *StdSink) Accept(a []Article)

func (*StdSink) Name

func (s *StdSink) Name() string

func (*StdSink) Serve

func (s *StdSink) Serve()

func (*StdSink) SetLogger

func (s *StdSink) SetLogger(*log.Logger)

func (*StdSink) Stop

func (s *StdSink) Stop()

type YencDecoder

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

func NewYencDecoder

func NewYencDecoder(reader io.Reader) *YencDecoder

func (*YencDecoder) Decode

func (d *YencDecoder) Decode() (*Part, error)

Jump to

Keyboard shortcuts

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