server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscoveryPort     = 8081
	BroadcastInterval = 30 * time.Second
	DiscoveryMagic    = "GOFLUX-LITE-DISCOVERY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoveryInfo added in v0.1.1

type DiscoveryInfo struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Address     string `json:"address"`
	Port        string `json:"port"`
	AuthEnabled bool   `json:"auth_enabled"`
	Timestamp   int64  `json:"timestamp"`
}

DiscoveryInfo represents server information broadcast on the network

type DiscoveryService added in v0.1.1

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

DiscoveryService handles UDP broadcast announcements

func NewDiscoveryService added in v0.1.1

func NewDiscoveryService(serverAddress, version string, authEnabled bool) (*DiscoveryService, error)

NewDiscoveryService creates a new discovery service

func (*DiscoveryService) Start added in v0.1.1

func (d *DiscoveryService) Start()

Start begins broadcasting server information

func (*DiscoveryService) Stop added in v0.1.1

func (d *DiscoveryService) Stop()

Stop halts the discovery service

type FirewallManager added in v0.1.1

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

FirewallManager handles automatic firewall rule creation

func NewFirewallManager added in v0.1.1

func NewFirewallManager(serverPort, discoveryPort int) *FirewallManager

NewFirewallManager creates a new firewall manager

func (*FirewallManager) EnsureFirewallRules added in v0.1.1

func (fm *FirewallManager) EnsureFirewallRules()

EnsureFirewallRules automatically creates firewall rules if needed

func (*FirewallManager) RemoveFirewallRules added in v0.1.1

func (fm *FirewallManager) RemoveFirewallRules()

RemoveFirewallRules removes the firewall rules (cleanup)

type Server

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

Server is a goflux server instance.

func New

func New(store storage.Storage, metaDir string) (*Server, error)

New creates a new Server.

func (*Server) EnableAuth

func (s *Server) EnableAuth(tokenStore *auth.TokenStore)

EnableAuth enables authentication on the server

func (*Server) EnableDiscovery added in v0.1.1

func (s *Server) EnableDiscovery(serverAddress, version string) error

EnableDiscovery enables the discovery service

func (*Server) EnableFirewall added in v0.1.1

func (s *Server) EnableFirewall(serverAddress string)

EnableFirewall enables automatic firewall configuration

func (*Server) SetConfig added in v0.1.1

func (s *Server) SetConfig(config *ServerConfig)

SetConfig sets the server configuration to share with clients

func (*Server) Start

func (s *Server) Start(addr string) error

Start starts the HTTP server.

type ServerConfig added in v0.1.1

type ServerConfig struct {
	Server struct {
		Address     string `json:"address"`
		StorageDir  string `json:"storage_dir"`
		MetaDir     string `json:"meta_dir"`
		TokensFile  string `json:"tokens_file,omitempty"`
		MaxFileSize int64  `json:"max_file_size"`
	} `json:"server"`
	Version     string `json:"version"`
	AuthEnabled bool   `json:"auth_enabled"`
}

ServerConfig represents server configuration that can be shared with clients

type UploadStatusResponse

type UploadStatusResponse struct {
	Exists        bool   `json:"exists"`         // whether a session exists
	TotalChunks   int    `json:"total_chunks"`   // total chunks expected
	ReceivedMap   []bool `json:"received_map"`   // bitmap of received chunks
	MissingChunks []int  `json:"missing_chunks"` // list of missing chunk IDs
	Completed     bool   `json:"completed"`      // upload completed
}

UploadStatusResponse contains the status of an upload session

Jump to

Keyboard shortcuts

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