service

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache *cache.Cache

Functions

func Containerd

func Containerd()

func DockerContainerStats1

func DockerContainerStats1() error

func DockerEx

func DockerEx()

拉取镜像

func DockerImageRemove

func DockerImageRemove(name string) error

func DockerLog

func DockerLog()

func DockerLogs

func DockerLogs()

func DockerNetwork

func DockerNetwork()

创建默认网络

func DockerPull

func DockerPull()

拉取镜像

func Exec

func Exec(container, row, col string) (hr types.HijackedResponse, err error)

func GetHead

func GetHead() map[string]string

固定请求head

func GetSearchType

func GetSearchType(ext string) int

func GetToken

func GetToken() string

func LoginGetToken

func LoginGetToken(username, pwd string) string

登录并获取token,会出现账号密码错误,和邮箱未验证情况,目前未出现其他情况

func MsqlExec

func MsqlExec(container string) error

func NewReader added in v0.2.4

func NewReader(ctx context.Context, r io.Reader) io.Reader

NewReader wraps an io.Reader to handle context cancellation.

Context state is checked BEFORE every Read.

func NewWriter added in v0.2.4

func NewWriter(ctx context.Context, w io.Writer) io.Writer

func SyncTask

func SyncTask(db *gorm.DB)

func UpdateDDNSList added in v0.2.3

func UpdateDDNSList(db *gorm.DB)

更新列表

func ZeroTierGet

func ZeroTierGet(url string, cookies []*http.Cookie, t uint8) (action string, c []*http.Cookie, isExistSession bool)

t 1:获取action,2:登录成功后拿session(可能需要验证有了或登录失败) 3:随机生成token 4:注册页面拿action 5:注册成功后拿验证邮箱的地址

func ZeroTierPost

func ZeroTierPost(str bytes.Buffer, action string, cookies []*http.Cookie, isLogin bool) (url, errInfo string, err error)

模拟提交表单

Types

type AppService

type AppService interface {
	GetMyList(index, size int, position bool) *[]model2.MyAppList
	SaveContainer(m model2.AppListDBModel)
	GetUninstallInfo(id string) model2.AppListDBModel
	RemoveContainerById(id string)
	GetContainerInfo(name string) (types.Container, error)
	GetAppDBInfo(id string) model2.AppListDBModel
	UpdateApp(m model2.AppListDBModel)
	GetSimpleContainerInfo(name string) (types.Container, error)
	DelAppConfigDir(path string)
	GetSystemAppList() *[]model2.MyAppList
	GetHardwareUsageSteam()
	GetHardwareUsage() []model.DockerStatsModel
	GetAppStats(id string) string
}

func NewAppService

func NewAppService(db *gorm.DB, logger loger2.OLog) AppService

type CasaService

type CasaService interface {
	GetServerList(index, size, tp, categoryId, key string) (recommend, list, community []model.ServerAppList)
	GetServerCategoryList() []model.ServerCategoryList
	GetTaskList(size int) []model2.TaskDBModel
	GetServerAppInfo(id, t string) model.ServerAppList
	ShareAppFile(body []byte) string
}

func NewOasisService

func NewOasisService() CasaService

type DDNSService

type DDNSService interface {
	IsExis(t int, domain string, host string) bool
	GetExternalIP() (string, string)
	GetConfigList() *[]model.DDNSList
	DeleteConfig(id uint) bool
	GetType(name string) (uint, string)
	SaveConfig(model model.DDNSUpdateDBModel) error
}

func NewDDNSService

func NewDDNSService(db *gorm.DB, log loger2.OLog) DDNSService

type DiskService

type DiskService interface {
	GetPlugInDisk() []string
	LSBLK() []model.LSBLKModel
	SmartCTL(path string) model.SmartctlA
	FormatDisk(path, format string) []string
	UmountPointAndRemoveDir(path string) []string
	GetDiskInfo(path string) model.LSBLKModel
	DelPartition(path, num string) string
	AddPartition(path string) string
	GetDiskInfoByPath(path string) *disk.UsageStat
	MountDisk(path, volume string)
	GetSerialAll() []model2.SerialDisk
	SaveMountPoint(m model2.SerialDisk)
	DeleteMountPoint(path, mountPoint string)
	DeleteMount(id string)
	UpdateMountPoint(m model2.SerialDisk)
	RemoveLSBLKCache()
}

func NewDiskService

func NewDiskService(log loger2.OLog, db *gorm.DB) DiskService

type DockerService

type DockerService interface {
	DockerPullImage(imageName string, m model2.AppNotify) error
	IsExistImage(imageName string) bool
	DockerContainerCreate(imageName string, containerDbId string, m model.CustomizationPostData, net string) (containerId string, err error)
	DockerContainerStart(name string) error
	DockerContainerStats(name string) (string, error)
	DockerListByName(name string) (*types.Container, error)
	DockerListByImage(image, version string) (*types.Container, error)
	DockerContainerInfo(name string) (*types.ContainerJSON, error)
	DockerImageRemove(name string) error
	DockerContainerRemove(name string, update bool) error
	DockerContainerStop(id string) error
	DockerContainerUpdateName(name, id string) (err error)
	DockerContainerUpdate(m model.CustomizationPostData, id string) (err error)
	DockerContainerLog(name string) (string, error)
	DockerContainerCommit(name string)
	DockerNetworkModelList() []types.NetworkResource
	DockerImageInfo(image string)
	GetNetWorkNameByNetWorkID(id string) (string, error)
	ContainerExecShell(container_id string) string
}

func NewDockerService added in v0.2.3

func NewDockerService(log loger2.OLog) DockerService

type GithubService

type GithubService interface {
	GetManifestJsonByRepo() (image, tcp, udp string)
}

func GetNewGithubService

func GetNewGithubService(cl *github.Client) GithubService

type NotifyServer

type NotifyServer interface {
	GetLog(id string) model.AppNotify
	AddLog(log model.AppNotify)
	UpdateLog(log model.AppNotify)
	DelLog(id string)
	GetList() (list []model.AppNotify)
	MarkRead(id string, state int)
}

func NewNotifyService

func NewNotifyService(db *gorm.DB) NotifyServer

type RedisService

type RedisService interface {
	Set(key string, data interface{}, time int) error
	Exists(key string) bool
	Get(key string) ([]byte, error)
	PutExpireTime(key string, time int)
	Delete(key string) (bool, error)
	LikeDeletes(key string) error
}

func NewRedisService

func NewRedisService(rp *redis.Pool) RedisService

type RelyService

type RelyService interface {
	Create(rely model2.RelyDBModel)
	Delete(id string)
	GetInfo(id string) model2.RelyDBModel
}

func NewRelyService

func NewRelyService(db *gorm.DB, log loger2.OLog) RelyService

type Repository

type Repository interface {
	App() AppService
	DDNS() DDNSService
	User() UserService
	Docker() DockerService
	//Redis() RedisService
	ZeroTier() ZeroTierService
	ZiMa() ZiMaService
	OAPI() CasaService
	Disk() DiskService
	Notify() NotifyServer
	ShareDirectory() ShareDirService
	Task() TaskService
	Rely() RelyService
	System() SystemService
	Shortcuts() ShortcutsService
	Search() SearchService
}
var MyService Repository

func NewService

func NewService(db *gorm.DB, log loger2.OLog) Repository

type SearchService

type SearchService interface {
	SearchList(key string) ([]model.SearchFileInfo, error)
}

func NewSearchService

func NewSearchService() SearchService

type ShareDirService

type ShareDirService interface {
	UpConfig()
	List(desc bool) []model.ShareDirDBModel
	Delete(id string)
	Add(m *model.ShareDirDBModel)
	Update(m *model.ShareDirDBModel)
	Info(id string) model.ShareDirDBModel
}

func NewShareDirService

func NewShareDirService(db *gorm.DB, log loger2.OLog) ShareDirService

type ShortcutsService

type ShortcutsService interface {
	DeleteData(id string)
	AddData(m model2.ShortcutsDBModel)
	EditData(m model2.ShortcutsDBModel)
	GetList() (list []model2.ShortcutsDBModel)
}

func NewShortcutsService

func NewShortcutsService(db *gorm.DB) ShortcutsService

type SystemService

type SystemService interface {
	UpSystemConfig(str string, widget string)
	UpdateSystemVersion(version string)
	GetSystemConfigDebug() []string
	GetCasaOSLogs(lineNumber int) string
	UpdateAssist()
	UpSystemPort(port string)
	GetTimeZone() string
}

func NewSystemService

func NewSystemService(log loger.OLog) SystemService

type TaskService

type TaskService interface {
	List(desc bool) []model.TaskDBModel
	Delete(id string)
	Add(m *model.TaskDBModel)
	Update(m *model.TaskDBModel)
	Info(id string) model.TaskDBModel
	SyncTaskService()
	GetServerTasks() []model.TaskDBModel
}

func NewTaskService

func NewTaskService(db *gorm.DB, log loger2.OLog) TaskService

type UserService

type UserService interface {
	SetUser(username, pwd, token, email, desc string) error
	UpLoadFile(file multipart.File, name string) error
}

func NewUserService

func NewUserService() UserService

获取用户Service

type ZeroTierService

type ZeroTierService interface {
	GetToken(username, pwd string) string
	ZeroTierRegister(email, lastName, firstName, password string) string
	ZeroTierNetworkList(token string) (interface{}, []string)
	ZeroTierJoinNetwork(networkId string)
	ZeroTierLeaveNetwork(networkId string)
	ZeroTierGetInfo(token, id string) (interface{}, []string)
	ZeroTierGetStatus(token string) interface{}
	EditNetwork(token string, data string, id string) interface{}
	CreateNetwork(token string) interface{}
	MemberList(token string, id string) interface{}
	EditNetworkMember(token string, data string, id, mId string) interface{}
	DeleteMember(token string, id, mId string) interface{}
	DeleteNetwork(token, id string) interface{}
	GetJoinNetworks() string
}

func NewZeroTierService

func NewZeroTierService() ZeroTierService

type ZiMaService

type ZiMaService interface {
	GetCpuPercent() float64
	GetCpuCoreNum() int
	GetMemInfo() *mem.VirtualMemoryStat
	GetDiskInfo() *disk.UsageStat
	GetNetInfo() []net.IOCountersStat
	GetNet(physics bool) []string
	GetNetState(name string) string
	GetSysInfo() host.InfoStat
	GetDirPath(path string) []model.Path
	MkdirAll(path string) (int, error)
	CreateFile(path string) (int, error)
	RenameFile(oldF, newF string) (int, error)
	GetCpuInfo() []cpu.InfoStat
}

系统信息

func NewZiMaService

func NewZiMaService() ZiMaService

获取zima服务

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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