config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort           = 53317
	DefaultMulticastGroup = "224.0.0.167"
	ProtocolVersion       = "2.1"
	DefaultSecurityDir    = ".localgo_security"
	DefaultSecurityFile   = "context.json"
)

Variables

This section is empty.

Functions

func InitViper added in v0.4.0

func InitViper() *viper.Viper

Types

type Config

type Config struct {
	Alias             string                        `json:"alias"`
	Port              int                           `json:"port"`
	HttpsEnabled      bool                          `json:"https_enabled"`
	MulticastGroup    string                        `json:"multicast_group"`
	DeviceModel       *string                       `json:"deviceModel"`
	DeviceType        model.DeviceType              `json:"deviceType"`
	SecurityContext   *crypto.StoredSecurityContext `json:"-"`
	SecurityPath      string                        `json:"-"`
	PIN               string                        `json:"-"`
	DownloadDir       string                        `json:"-"`
	AutoAccept        bool                          `json:"-"`
	RandomFingerprint string                        `json:"-"`
	MaxBodySize       int64                         `json:"-"`
	NoClipboard       bool                          `json:"-"` // skip clipboard; save text as a file instead
	HistoryFile       string                        `json:"-"` // path to transfer history jsonl file
	Quiet             bool                          `json:"-"` // quiet mode - minimal output
	ExecHook          string                        `json:"-"` // shell command to run after receiving file
	OpenDir           bool                          `json:"-"` // open download directory after transfer
}

func LoadConfig

func LoadConfig(v *viper.Viper, logger *zap.SugaredLogger) (*Config, error)

func (*Config) GetFingerprint added in v0.4.0

func (c *Config) GetFingerprint() string

GetFingerprint returns the appropriate fingerprint (certificate hash if HTTPS, random otherwise).

func (*Config) Protocol added in v0.4.0

func (c *Config) Protocol() model.ProtocolType

Protocol returns the protocol type based on HttpsEnabled.

func (*Config) ToInfoDto

func (c *Config) ToInfoDto() model.InfoDto

ToInfoDto converts Config to model.InfoDto for discovery requests

func (*Config) ToMulticastDto added in v0.4.0

func (c *Config) ToMulticastDto(download bool) model.MulticastDto

ToMulticastDto creates a MulticastDto from the current configuration.

func (*Config) ToRegisterDto

func (c *Config) ToRegisterDto() model.RegisterDto

ToRegisterDto converts Config to model.RegisterDto for discovery requests

Jump to

Keyboard shortcuts

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