Documentation
¶
Index ¶
- Constants
- type ChunkData
- type DiscoveredServer
- type DiscoveryClient
- type HTTPClient
- func (h *HTTPClient) Delete(path string) error
- func (h *HTTPClient) Dial(addr string) error
- func (h *HTTPClient) Download(path string) ([]byte, error)
- func (h *HTTPClient) List(path string) ([]string, error)
- func (h *HTTPClient) Listen(addr string) error
- func (h *HTTPClient) Mkdir(path string) error
- func (h *HTTPClient) QueryUploadStatus(path string) (*UploadStatusResponse, error)
- func (h *HTTPClient) SetAuthToken(token string)
- func (h *HTTPClient) UploadChunk(chunk ChunkData) error
- type Transport
- type UploadStatusResponse
Constants ¶
const ( ClientDiscoveryPort = 8081 DiscoveryTimeout = 5 * time.Second ServerExpiry = 60 * time.Second DiscoveryMagicResponse = "GOFLUX-LITE-DISCOVERY" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChunkData ¶
type ChunkData struct {
Path string `json:"path"`
ChunkID int `json:"chunk_id"`
Data []byte `json:"data"`
Checksum string `json:"checksum"`
Total int `json:"total"` // total number of chunks
}
ChunkData represents chunk data being transferred.
type DiscoveredServer ¶ added in v0.1.1
type DiscoveredServer 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"`
LastSeen time.Time
}
DiscoveredServer represents a server found on the network
type DiscoveryClient ¶ added in v0.1.1
type DiscoveryClient struct {
// contains filtered or unexported fields
}
Discovery client for finding GoFlux servers on the network
func NewDiscoveryClient ¶ added in v0.1.1
func NewDiscoveryClient() *DiscoveryClient
NewDiscoveryClient creates a new discovery client
func (*DiscoveryClient) DiscoverServers ¶ added in v0.1.1
func (d *DiscoveryClient) DiscoverServers() ([]*DiscoveredServer, error)
DiscoverServers scans the network for GoFlux servers
func (*DiscoveryClient) FormatServerList ¶ added in v0.1.1
func (d *DiscoveryClient) FormatServerList(servers []*DiscoveredServer) string
FormatServerList returns a human-readable list of discovered servers
func (*DiscoveryClient) GetServerConfig ¶ added in v0.1.1
func (d *DiscoveryClient) GetServerConfig(serverAddr string) (map[string]interface{}, error)
GetServerConfig retrieves configuration from a discovered server
type HTTPClient ¶
type HTTPClient struct {
BaseURL string
// contains filtered or unexported fields
}
HTTPClient is an HTTP-based transport client.
func NewHTTPClient ¶
func NewHTTPClient(baseURL string) *HTTPClient
func (*HTTPClient) Delete ¶ added in v0.1.1
func (h *HTTPClient) Delete(path string) error
Delete removes a file or directory at the specified path.
func (*HTTPClient) Dial ¶
func (h *HTTPClient) Dial(addr string) error
func (*HTTPClient) Download ¶
func (h *HTTPClient) Download(path string) ([]byte, error)
Download downloads a file.
func (*HTTPClient) List ¶
func (h *HTTPClient) List(path string) ([]string, error)
List lists files at a path.
func (*HTTPClient) Listen ¶
func (h *HTTPClient) Listen(addr string) error
func (*HTTPClient) Mkdir ¶ added in v0.1.1
func (h *HTTPClient) Mkdir(path string) error
Mkdir creates a directory at the specified path.
func (*HTTPClient) QueryUploadStatus ¶
func (h *HTTPClient) QueryUploadStatus(path string) (*UploadStatusResponse, error)
QueryUploadStatus checks the status of an upload on the server
func (*HTTPClient) SetAuthToken ¶
func (h *HTTPClient) SetAuthToken(token string)
SetAuthToken sets the authentication token for requests
func (*HTTPClient) UploadChunk ¶
func (h *HTTPClient) UploadChunk(chunk ChunkData) error
UploadChunk uploads a single chunk.
type UploadStatusResponse ¶
type UploadStatusResponse struct {
Exists bool `json:"exists"`
TotalChunks int `json:"total_chunks"`
ReceivedMap []bool `json:"received_map"`
MissingChunks []int `json:"missing_chunks"`
Completed bool `json:"completed"`
}
UploadStatusResponse contains the status of an upload session