req

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppNotInstalledTemplate = &SyncthingStatus{
	Status: End,
	Msg:    "Application not installed",
	Tips:   Identifier + "Current Application is not installed, please check your application is installed correctly.",
}
View Source
var DevModeStarting = &SyncthingStatus{
	Status: End,
	Msg:    "DevMode Starting...",
	Tips:   Identifier + "File sync in preparation.",
}
View Source
var NotInDevModeTemplate = &SyncthingStatus{
	Status: End,
	Msg:    "Not in DevMode",
	Tips:   Identifier + "File sync does not working due to the devMode is not enabled.",
}
View Source
var NotProcessor = &SyncthingStatus{
	Status: End,
	Msg:    "Other device is developing",
	Tips: Identifier + "File Sync is hold by other device, if you want to take over the file sync, " +
		"you should end the dev mode and re enter again.",
}
View Source
var NotSyncthingProcessFound = &SyncthingStatus{
	Status: Disconnected,
	Msg:    "No syncthing process found",
	Tips:   Identifier + "No syncthing process found, please restart it.",
}
View Source
var WelcomeTemplate = &SyncthingStatus{
	Status: End,
	Msg:    "Welcome to Nocalhost",
	Tips:   Identifier + "There is no service associated with the current directory",
}

Functions

func ResponseToBArray

func ResponseToBArray(response *http.Response) ([]byte, error)

Types

type ConnectionStats

type ConnectionStats struct {
	Address       string
	Type          string
	Connected     bool
	Paused        bool
	ClientVersion string
	InBytesTotal  int64
	OutBytesTotal int64
}

type ConnectionStatsResponse

type ConnectionStatsResponse struct {
	Connections map[string]ConnectionStats `json:"connections"`
}

type EventType

type EventType string
const (
	EventFolderCompletion EventType = "FolderCompletion"
)

type FolderCompletion

type FolderCompletion struct {
	Completion  float64 `json:"completion"`
	GlobalBytes int64   `json:"globalBytes"`
	NeedBytes   int64   `json:"needBytes"`
	GlobalItems int     `json:"globalItems"`
	NeedItems   int     `json:"needItems"`
	NeedDeletes int     `json:"needDeletes"`
	Sequence    int64   `json:"sequence"`
}

func (*FolderCompletion) NeedOverrideForce

func (f *FolderCompletion) NeedOverrideForce() bool

func (*FolderCompletion) UploadPct

func (f *FolderCompletion) UploadPct() string

type Model

type Model struct {
	GlobalBytes   int
	GlobalDeleted int
	GlobalFiles   int
	InSyncBytes   int
	InSyncFiles   int
	Invalid       string
	LocalBytes    int
	LocalDeleted  int
	LocalFiles    int
	NeedBytes     int
	NeedFiles     int
	State         string
	StateChanged  time.Time
	Version       int
}

func (*Model) IdleTips

func (m *Model) IdleTips() string

func (*Model) OutOfSync

func (m *Model) OutOfSync() string

func (*Model) OutOfSyncLog

func (m *Model) OutOfSyncLog() string

func (*Model) OutOfSyncTips

func (m *Model) OutOfSyncTips() string

func (*Model) StateChangedLog

func (m *Model) StateChangedLog() string

type StatusEnum

type StatusEnum string
const (
	Disconnected StatusEnum = "disconnected"
	OutOfSync    StatusEnum = "outOfSync"
	Scanning     StatusEnum = "scanning"
	Syncing      StatusEnum = "syncing"
	Error        StatusEnum = "error"
	Idle         StatusEnum = "idle"
	End          StatusEnum = "end"

	Identifier = "(Nocalhost): "
)

Use strings as keys to make printout and serialization of the locations map more meaningful.

type SyncthingHttpClient

type SyncthingHttpClient struct {
	// contains filtered or unexported fields
}

func NewSyncthingHttpClient

func NewSyncthingHttpClient(
	guiHost string,
	apiKey string,
	remoteDevice string,
	folderName string,
	reqTimeoutSecond int) *SyncthingHttpClient

func (*SyncthingHttpClient) Completion

func (p *SyncthingHttpClient) Completion() (FolderCompletion, error)

func (*SyncthingHttpClient) Events

func (p *SyncthingHttpClient) Events(since int64) ([]event, error)

func (*SyncthingHttpClient) FolderOverride

func (p *SyncthingHttpClient) FolderOverride() error

func (*SyncthingHttpClient) FolderStatus

func (p *SyncthingHttpClient) FolderStatus() (Model, error)

func (*SyncthingHttpClient) GetSyncthingStatus

func (p *SyncthingHttpClient) GetSyncthingStatus() *SyncthingStatus

func (*SyncthingHttpClient) Post

func (s *SyncthingHttpClient) Post(path, body string) ([]byte, error)

func (*SyncthingHttpClient) Scan

func (p *SyncthingHttpClient) Scan() error

func (*SyncthingHttpClient) SystemConnections

func (p *SyncthingHttpClient) SystemConnections() (bool, error)

type SyncthingStatus

type SyncthingStatus struct {
	Status    StatusEnum `yaml:"status" json:"status"`
	Msg       string     `json:"msg"`
	Tips      string     `json:"tips,omitempty"`
	OutOfSync string     `json:"outOfSync,omitempty"`
	Gui       string     `json:"gui,omitempty"`
}

the nhctl sync --status result

Jump to

Keyboard shortcuts

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