model

package
v0.0.0-...-12f948b Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSalt

func GenSalt() string

Types

type AtomFeed

type AtomFeed struct {
	Domain  string
	BaseURL *url.URL
	Entries []FeedEntry
	Title   string
	ID      string
}

func (*AtomFeed) MarshalXML

func (feed *AtomFeed) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type Category

type Category struct {
	Name        string
	ID          int
	GetTorrents func() []Torrent `json:"-"`
}

type Comment

type Comment struct {
	ID      uint64
	Text    string
	Posted  time.Time
	Domain  string
	Torrent *Torrent
}

func (Comment) MarshalXML

func (c Comment) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (Comment) UploadedAt

func (c Comment) UploadedAt() time.Time

type FeedEntry

type FeedEntry interface {
	xml.Marshaler
	UploadedAt() time.Time
}

type File

type File struct {
	Name string
	Size uint64
}

func (*File) SizeString

func (f *File) SizeString() string
type Link struct {
	URL string `xml:"href,attr"`
}
func NewLink(domain, path, fragment string) Link
func NewQueryLink(domain, path, query string) Link

type LoginCred

type LoginCred string

hashed login credential

func HashCred

func HashCred(secret, salt string) LoginCred

func (LoginCred) Check

func (cred LoginCred) Check(secret string) bool

func (LoginCred) Salt

func (cred LoginCred) Salt() string

func (LoginCred) String

func (cred LoginCred) String() string

type Tag

type Tag struct {
	Name   string
	ID     uint64
	Rank   uint64
	Domain string
}

func (Tag) MarshalXML

func (t Tag) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (t *Tag) SearchLink() string

func (Tag) UploadedAt

func (t Tag) UploadedAt() time.Time

type Torrent

type Torrent struct {
	Domain       string
	Name         string
	Tags         []Tag
	Category     Category
	PieceSize    uint32
	Size         uint64
	Uploaded     int64
	IH           [20]byte
	AnnounceURLS []string
}
func (t *Torrent) DownloadLink() string

func (*Torrent) InfoHash

func (t *Torrent) InfoHash() string

func (*Torrent) Magnet

func (t *Torrent) Magnet() string

func (*Torrent) MarshalJSON

func (t *Torrent) MarshalJSON() (data []byte, err error)

func (Torrent) MarshalXML

func (t Torrent) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Torrent) PageLocation

func (t *Torrent) PageLocation() string

func (*Torrent) SizeString

func (t *Torrent) SizeString() string

func (Torrent) UploadedAt

func (t Torrent) UploadedAt() time.Time

type User

type User struct {
	Username string
	Login    LoginCred
}

func NewUser

func NewUser(username, password string) *User

create a new user with username, hash credential with a fresh salt

Jump to

Keyboard shortcuts

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