Documentation

Index

Constants

View Source
const BLACK = "\033[40m  \033[0m"
View Source
const DIR_MASK = 0770
View Source
const WHITE = "\033[47m  \033[0m"

Variables

This section is empty.

Functions

func CompressFile

func CompressFile(source, target string) error

func CompressedFilePath

func CompressedFilePath() string

func ConfigFile

func ConfigFile() string

func ConfigFileSQLITE

func ConfigFileSQLITE() string

func ConfigFileServerEndPoint

func ConfigFileServerEndPoint(settings SettingsShare) string

func ConfigFolder

func ConfigFolder() string

func ConfigServerEndPoint

func ConfigServerEndPoint(settings SettingsShare) string

func CreateConfigFile

func CreateConfigFile(outputFile string, settings SettingsShare) error

func CreateTable

func CreateTable() error

func FileServerGET

func FileServerGET(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func GenerateQR

func GenerateQR(uuid, input string) (string, error)

func GetLocalIps

func GetLocalIps(port int, uuid string) []string

func GetPublicIps

func GetPublicIps(port int, uuid string) []string

func GetServerIps

func GetServerIps(upnpOpened bool, port int, uuid string) []string

func InitDB

func InitDB(settings_params SettingsShare) error

func InitSettings

func InitSettings(configFile string, settings *SettingsShare) error

func OpenDatabase

func OpenDatabase() (*sql.DB, error)

func OpenUpnpPort

func OpenUpnpPort(port int) bool

func RandomFreePort

func RandomFreePort() (int, error)

func RemoveServer

func RemoveServer(uuid string) error

func RunFileServer

func RunFileServer(settings SettingsShare)

func StoreServer

func StoreServer(server Server) error

func TempFilename

func TempFilename(prefix string, extension string) string

func UserHomeDir

func UserHomeDir(runtime_goos string) string

Types

type FileServerDaemon

type FileServerDaemon struct {
	Port int
	Host string
}

type Server

type Server struct {
	UUID      string    `json:"uuid"`
	Path      string    `json:"path"`
	Source    string    `json:"source"`
	CreatedAt time.Time `json:"created_at"`
	ListIps   []string  `json:"list_ips"`
	Flags     []string  `json:"flags"`
}

func FindServer

func FindServer(uuid string) (Server, error)

func ListServers

func ListServers() ([]Server, error)

func SearchServerByPath

func SearchServerByPath(path string) (Server, error)

func SearchServerByUUID

func SearchServerByUUID(uuid string) (Server, error)

type SettingsShare

type SettingsShare struct {
	ShareDaemon      ShareDaemon
	FileServerDaemon FileServerDaemon
	Mode             string
}

func NewSettings

func NewSettings() SettingsShare

type ShareDaemon

type ShareDaemon struct {
	Port               int
	Host               string
	EnableUpnp         bool
	DatabaseFilePath   string
	CompressedFilePath string
}