nxg

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 14 Imported by: 0

README

NXG utils

Nxg utils to build nxg links

What is NXG?

Is a new way to build Usenet message ID's that allows to share NZB files without the need of an actual .nzb file. Instead a link with the NXG header is shared and the client can use that to download all associated files from usenet.

See NXG

Development Setup

To set up the project for development, follow these steps:

  1. Clone the repository:
git clone https://github.com/javi11/nxg.git
cd nxg
  1. Install dependencies:
go mod download
  1. Run tests:
make test
  1. Lint the code:
make lint
  1. Generate mocks and other code:
make generate

Contributing

Contributions are welcome! Please open an issue or submit a pull request. See the CONTRIBUTING.md file for details.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedDecodeBase64Header       = fmt.Errorf("failed to decode base64 header")
	ErrUnexpectedHeaderFmt            = fmt.Errorf("unexpected header format")
	ErrFailedToParseTotalDataArticles = fmt.Errorf("failed to parse total data articles")
	ErrParseTotalPar2Articles         = fmt.Errorf("failed to parse total par2 articles")
	ErrUnexpectedHashLength           = fmt.Errorf("unexpected hash length")
)

Error messages

Functions

This section is empty.

Types

type DecodedNxgHeader

type DecodedNxgHeader struct {
	RandomString   string
	TotalDataParts int64
	TotalParParts  int64
}

NXGHeader represents the decoded components of an NXG header.

func DecodeNXGHeader

func DecodeNXGHeader(encodedHeader string) (*DecodedNxgHeader, error)

DecodeNXGHeader decodes a base64-encoded NXG header into its components.

type Header [28]byte

func GenerateNXGHeader

func GenerateNXGHeader(totalDataParts, totalParParts int64) Header

GenerateNXGHeader generates the NXG header string from its components.

func (Header) GenerateSegmentID

func (h Header) GenerateSegmentID(partType PartType, partNumber int64) (string, error)

GenerateSegmentID generates the segment ID based on the NXG header, article type, and article number.

func (h Header) GetNxgLink(
	queryStr map[string][]string,
) string

func (Header) GetObfuscatedPoster

func (h Header) GetObfuscatedPoster(
	partType PartType,
	partNumber int64,
) (string, error)

func (Header) GetObfuscatedSubject

func (h Header) GetObfuscatedSubject(
	partType PartType,
	partNumber int64,
) (string, error)

func (Header) GetXNxgHeader

func (h Header) GetXNxgHeader(
	fileNumber,
	totalFiles int64,
	filename string,
	partType PartType,
	totalDownloadSize int64,
) (string, error)

func (Header) String

func (h Header) String() string

type PartType

type PartType string
const (
	PartTypeData PartType = "data"
	PartTypePar2 PartType = "par2"
)

Jump to

Keyboard shortcuts

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