Categorygithub.com/scottjab/nntp
modulepackage
1.0.0
Repository: https://github.com/scottjab/nntp.git
Documentation: pkg.go.dev

# README

nntp.go

An NNTP (news) Client package for go (golang). Forked from nntp.

  • Changed to using net/textproto
  • Added support for compressed XOVER responses

Example

  // connect to news server
  conn, err := nntp.NewTLS("tcp", "news.example.com:563", nil)
  if err != nil {
    log.Fatalf("connection failed: %v", err)
  }

  // auth
  if err := conn.Authenticate("user", "pass"); err != nil {
    log.Fatalf("Could not authenticate")
  }

  // connect to a news group
  grpName := "alt.binaries.pictures"
  group, err := conn.Group(grpName)
  if err != nil {
    log.Fatalf("Could not connect to group %s: %v %d", grpName, err)
  }

  // fetch an article
  id := "<[email protected]>"
  article, err := conn.Article(id)
  if err != nil {
    log.Fatalf("Could not fetch article %s: %v", id, err)
  }

  // read the article contents
  body := strings.Join(article.Body,"")

# Functions

New connects to an NNTP server.
NewTLS connects with TLS.

# Structs

Article
An Article represents an NNTP article.
A Conn represents a connection to an NNTP server.
A Group gives information about a single news group on the server.
MessageOverview of a message returned by OVER/XOVER command.

# Type aliases

A ProtocolError represents responses from an NNTP server that seem incorrect for NNTP.