torrentValidator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTrackers

func CheckTrackers(trackers []string) []string

CheckTrackers : Check if there is good trackers in torrent

Types

type ReassignForm

type ReassignForm struct {
	AssignTo uint
	By       string
	Data     string

	Torrents []uint
}

ReassignForm : Structure for reassign Form used by the reassign page

func (*ReassignForm) ExtractInfo

func (f *ReassignForm) ExtractInfo(c *gin.Context) bool

ExtractInfo : Function to assign values from request to ReassignForm

type TorrentRequest

type TorrentRequest struct {
	Name        string   `validate:"required" form:"name" json:"name,omitempty"`
	Magnet      string   `json:"magnet,omitempty" form:"magnet"`
	Category    string   `validate:"required" form:"c" json:"c"`
	Remake      bool     `json:"remake,omitempty" form:"remake"`
	Description string   `json:"desc,omitempty" form:"desc"`
	Status      int      `json:"status,omitempty" form:"status"`
	Hidden      bool     `json:"hidden,omitempty" form:"hidden"`
	CaptchaID   string   `json:"-" form:"captchaID"`
	WebsiteLink string   `validate:"uri" json:"website_link,omitempty" form:"website_link"`
	SubCategory int      `json:"sub_category,omitempty" form:"sub_category"`
	Languages   []string `json:"languages,omitempty" form:"languages"`

	Infohash      string         `json:"hash,omitempty" form:"hash"`
	CategoryID    int            `json:"-" form:"category_id"`
	SubCategoryID int            `json:"-" form:"subcategory_id"`
	Filesize      int64          `json:"filesize,omitempty"`
	Filepath      string         `json:"-"`
	FileList      []uploadedFile `json:"filelist,omitempty"`
	Trackers      []string       `json:"trackers,omitempty"`
}

TorrentRequest struct Same json name as the constant!

func (*TorrentRequest) ExtractCategory

func (r *TorrentRequest) ExtractCategory() error

ExtractCategory : takes an http request and computes category field for this form

func (*TorrentRequest) ExtractLanguage

func (r *TorrentRequest) ExtractLanguage() error

ExtractLanguage : takes a http request, computes the torrent language from the form.

func (*TorrentRequest) ValidateDescription

func (r *TorrentRequest) ValidateDescription() error

func (*TorrentRequest) ValidateHash

func (r *TorrentRequest) ValidateHash() error

func (*TorrentRequest) ValidateMagnet

func (r *TorrentRequest) ValidateMagnet() error

func (*TorrentRequest) ValidateMultipartUpload

func (r *TorrentRequest) ValidateMultipartUpload(c *gin.Context, uploadFormTorrent string) (multipart.File, error)

ValidateMultipartUpload : Check if multipart upload is valid

func (*TorrentRequest) ValidateName

func (r *TorrentRequest) ValidateName() error
func (r *TorrentRequest) ValidateWebsiteLink() error

type UpdateRequest

type UpdateRequest struct {
	ID     uint           `json:"id"`
	Update TorrentRequest `json:"update"`
}

UpdateRequest struct

Jump to

Keyboard shortcuts

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