syno

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

README

go-syno: A Go library to interact with Synology packages

Build Status GoDoc Reference GoReport Maintainability Test Coverage

Under heavy work, please refrain from using it until the first release.

go get gopkg.in/jdel/go-syno.v0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Families map[string][]string

Families contains families - arch mappings

View Source
var LogDebugLevel = func() log.Level { return log.DebugLevel }()

LogDebugLevel is a shorthand for logrus.DebugLevel

View Source
var LogErrorLevel = func() log.Level { return log.ErrorLevel }()

LogErrorLevel is a shorthand for logrus.ErrorLevel

View Source
var LogFatalLevel = func() log.Level { return log.FatalLevel }()

LogFatalLevel is a shorthand for logrus.FatalLevel

View Source
var LogInfoLevel = func() log.Level { return log.InfoLevel }()

LogInfoLevel is a shorthand for logrus.InfoLevel

View Source
var LogPanicLevel = func() log.Level { return log.PanicLevel }()

LogPanicLevel is a shorthand for logrus.PanicLevel

View Source
var LogWarnLevel = func() log.Level { return log.WarnLevel }()

LogWarnLevel is a shorthand for logrus.WarnLevel

Functions

func SetLogLevel

func SetLogLevel(l log.Level)

SetLogLevel sets the logrus log level

func SetLogOutput

func SetLogOutput(i io.Writer)

SetLogOutput sets the logrus log output

func SetOptions

func SetOptions(opt Options)

SetOptions sets global options

Types

type Model

type Model struct {
	Name    string `json:"name,omitempty"`
	CPU     string `json:"cpu,omitempty"`
	Cores   string `json:"cores,omitempty"`
	Threads string `json:"threads,omitempty"`
	FPU     string `json:"fpu,omitempty"`
	Arch    string `json:"arch,omitempty"`
	RAM     string `json:"ram,omitempty"`
}

Model represents a Synology model

type Models

type Models []*Model

Models is a slice of Model

func GetModels

func GetModels(forceRefresh bool) (Models, error)

GetModels returns Synology models from file or fall back to web craling

func (Models) FilterByName

func (m Models) FilterByName(query string) Models

FilterByName filters models by name

func (Models) SaveModelsFile

func (m Models) SaveModelsFile() error

SaveModelsFile saves the model file to o.ModelsFile

type Options

type Options struct {
	PackagesDir string
	CacheDir    string
	ModelsFile  string
	Language    string
	MD5         bool
}

Options holds external context

func GetOptions

func GetOptions() *Options

GetOptions returns global options

type Package

type Package struct {

	// Mandatory fields
	Name             string `json:"package,omitempty"`
	DisplayName      string `json:"dname,omitempty"`
	Version          string `json:"version,omitempty"`
	Firmware         string `json:"firmware,omitempty"` // Replaced by OsMinimumVersion after 6.1-14715
	OSMinimumVersion string `json:"os_min_ver,omitempty"`
	Description      string `json:"desc,omitempty"`
	Arch             string `json:"arch,omitempty"`
	Maintainer       string `json:"maintainer,omitempty"`
	PackageIcon      string `json:"package_icon,omitempty"`
	PackageIcon256   string `json:"package_icon_256,omitempty"`
	// Optional fields
	MaintainerURL             string `json:"maintainer_url,omitempty"`
	Distributor               string `json:"distributor,omitempty"`
	DistributorURL            string `json:"distributor_url,omitempty"`
	SupportURL                string `json:"support_url,omitempty"`
	SupportCenter             string `json:"support_center, omitempty"`
	Model                     string `json:"model,omitempty"`
	ExcludeArch               string `json:"exclude_arch,omitempty"` //maybe handle that ?
	Checksum                  string `json:"checksum,omitempty"`
	AdminPort                 string `json:"adminport,omitempty"`
	AdminURL                  string `json:"adminurl,omitempty"`
	AdminProtocol             string `json:"adminprotocol,omitempty"`
	DSMUIDir                  string `json:"dsmuidir,omitempty"`
	DSMAppDir                 string `json:"dsmappdir,omitempty"`
	Changelog                 string `json:"changelog,omitempty"`
	CheckPort                 bool   `json:"checkport,omitempty"`
	Startable                 bool   `json:"startable,omitempty"` // Replaced by ConstrolStop after 6.1-14907
	ConstrolStop              bool   `json:"ctl_stop,omitempty"`
	ConstrolUninstall         bool   `json:"ctl_uninstall,omitempty"`
	PreCheckStartStop         bool   `json:"precheckstartstop,omitempty"`
	HelpURL                   string `json:"helpurl,omitempty"`
	Beta                      bool   `json:"beta,omitempty"`
	ReportURL                 string `json:"report_url,omitempty"`
	InstallReboot             bool   `json:"install_reboot,omitempty"`
	InstallDepPackages        string `json:"install_dep_packages,omitempty"`
	InstallConflictPackages   string `json:"install_conflict_packages,omitempty"`
	InstallBreakPackages      string `json:"install_break_packages,omitempty"`
	InstallReplacePackages    string `json:"install_replace_packages,omitempty"`
	InstUninstRestartServices string `json:"instuninst_restart_services,omitempty"`
	StartStopRestartServices  string `json:"startstop_restart_services,omitempty"`
	InstallDepServices        string `json:"install_dep_services,omitempty"`
	StartDepServices          bool   `json:"start_dep_services,omitempty"`
	ExtractSize               string `json:"extractsize,omitempty"`
	SupportConfFolder         bool   `json:"support_conf_folder,omitempty"` // Deprecated after 6.0
	InstallType               string `json:"install_type,omitempty"`
	SilentInstall             bool   `json:"silent_install,omitempty"`
	SilentUpgrade             bool   `json:"silent_upgrade,omitempty"`
	SilentUninstall           bool   `json:"silent_uninstall,omitempty"`
	AutoUpgradeFrom           string `json:"auto_upgrade_from,omitempty"`
	OfflineInstall            bool   `json:"offline_install,omitempty"`
	ThirdParty                bool   `json:"thirdparty,omitempty"`
	OSMaximumVersion          bool   `json:"os_max_ver,omitempty"`
	// Package Center metadata
	Start                bool     `json:"start,omitempty"`
	Price                string   `json:"price,omitempty"`
	DownloadCount        string   `json:"download_count,omitempty"`
	ServiceDependencies  string   `json:"depsers,omitempty"`
	PackagesDependencies string   `json:"deppkgs,omitempty"`
	PackagesConflicts    string   `json:"conflictpkgs,omitempty"`
	RecentDownloadCount  string   `json:"recent_download_count,omitempty"`
	Link                 string   `json:"link,omitempty"`
	Size                 string   `json:"size,omitempty"`
	MD5                  string   `json:"md5,omitempty"`
	QuickInstall         bool     `json:"qinst,omitempty"`
	QuickStart           bool     `json:"qstart,omitempty"`
	QuickUpgrade         bool     `json:"qupdate,omitempty"`
	Thumbnail            []string `json:"thumbnail,omitempty"`
	ThumbnailRetina      []string `json:"thumbnail_retina,omitempty"`
	Snapshot             []string `json:"snapshot,omitempty"`
	Category             string   `json:"category,omitempty"`
	SubCategory          string   `json:"subcategory,omitempty"`
	Type                 string   `json:"type,omitempty"`
	// contains filtered or unexported fields
}

Package represents a Synology package

func NewDebugPackage

func NewDebugPackage(description string) *Package

NewDebugPackage creates a new debug package from the description string

func NewPackage

func NewPackage(synoPackageName string) (*Package, error)

NewPackage creates a new package from the spk file

func (*Package) ExistsOnDisk

func (p *Package) ExistsOnDisk() bool

ExistsOnDisk returns true if the package file exists on disk

func (*Package) FullPath

func (p *Package) FullPath() string

FullPath returns the package full path on FS

type Packages

type Packages []*Package

Packages is a slice of Package

func (Packages) FilterByArch

func (p Packages) FilterByArch(query string) Packages

FilterByArch filters synopkgs where Arch = query

func (Packages) FilterByFirmware

func (p Packages) FilterByFirmware(query string) Packages

FilterByFirmware filters synopkgs where Version >= query

func (Packages) FilterOutBeta

func (p Packages) FilterOutBeta() Packages

FilterOutBeta returns synopkgs except beta packages

func (Packages) Len

func (p Packages) Len() int

sort.Sort Interface implementtion

func (Packages) Less

func (p Packages) Less(i, j int) bool

func (Packages) OnlyShowLastVersion

func (p Packages) OnlyShowLastVersion() Packages

OnlyShowLastVersion overrides an existing package with a new one if the version is greater the comparison is done on the Name property

func (Packages) SearchByName

func (p Packages) SearchByName(query string) Packages

SearchByName filters synopkgs name contains query

func (Packages) Swap

func (p Packages) Swap(i, j int)

Jump to

Keyboard shortcuts

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