Documentation
¶
Index ¶
- Constants
- Variables
- func APIVersionToInt(apiVersion string) (int, error)
- func ComputePassword(key, challenge string) string
- func EncodePath(path string) string
- func EndpointTester(t *testing.T, ep *Endpoint, data interface{}, urlparams map[string]string, ...)
- func MdnsDiscover(fbChan chan<- *Freebox)
- func MdnsResolve(domain string) (host net.IP, err error)
- func ResultFromResponse(resp *APIResponse, result interface{}) (err error)
- func SelectRequestMethod(updateMethod string, fn func(interface{}) bool, data interface{}) (method string, body []byte, err error)
- type APIResponse
- type APIVersion
- type App
- type Authorization
- type AuthorizationState
- type Client
- func (c *Client) Dl(path string) (resp *http.Response, err error)
- func (c *Client) Info(path string) (respFileInfo *FileInfo, err error)
- func (c *Client) Login() (respLogin *RespLogin, err error)
- func (c *Client) Logout() (err error)
- func (c *Client) Ls(path string, onlyFolder, countSubFolder, removeHidden bool) (respFileInfo []FileInfo, err error)
- func (c *Client) Query(ep *Endpoint) Query
- func (c *Client) Register(tokenReq *TokenRequest) (respAuth *Authorization, err error)
- func (c *Client) Session(reqSess ReqSession) (respSess *RespSession, err error)
- func (c *Client) Upload(path, destDir string) (err error)
- func (c *Client) WithSession(session *Session) *Client
- type ConnectionLog
- type ConnectionStatus
- type Download
- type DownloadReq
- type DownloadTask
- type Endpoint
- type FSTask
- type FTPConfig
- type FileInfo
- type FileUpload
- type FileUploadChunkResponse
- type FileUploadChunkResult
- type FileUploadStartAction
- type Freebox
- type InterfaceStat
- type LanConfig
- type LanHost
- type LanHostL2Ident
- type LanHostL3Connectivity
- type LanHostName
- type Query
- func (q Query) As(params map[string]string) Query
- func (q Query) Do(endStruct interface{}) (err error)
- func (q Query) DoRequest() (resp *http.Response, err error)
- func (q Query) Inspect(resp *APIResponse) Query
- func (q Query) WS() (conn *websocket.Conn, err error)
- func (q Query) WithBody(body interface{}) Query
- func (q Query) WithFormBody(body interface{}) Query
- func (q Query) WithParams(params url.Values) Query
- type ReqHost
- type ReqSession
- type ReqWoL
- type RespLogin
- type RespSession
- type Session
- type ShareLink
- type SystemConfig
- type TokenRequest
- type WSNotification
- type WSRequest
- type WSResponse
Constants ¶
View Source
const AUTHHEADER = "X-Fbx-App-Auth"
View Source
const AUTH_STATUS_GRANTED = "granted"
View Source
const AUTH_STATUS_PENDING = "pending"
View Source
const CTHEADER = "Content-Type"
View Source
const FreeboxRootCA = `` /* 2003-byte string literal not displayed */
View Source
const HTTP_METHOD_DELETE = "DELETE"
View Source
const HTTP_METHOD_GET = "GET"
View Source
const HTTP_METHOD_POST = "POST"
View Source
const HTTP_METHOD_PUT = "PUT"
View Source
const IPV4 = "ipv4"
View Source
const MULTICASTDNSADDR = "224.0.0.251:5353"
View Source
const PROTO_HTTP = "http"
View Source
const PROTO_HTTPS = "https"
View Source
const PROTO_WS = "ws"
View Source
const PROTO_WSS = "wss"
View Source
const SERVICE = "_fbx-api._tcp"
Variables ¶
View Source
var AddDownloadEP = &Endpoint{ Verb: HTTP_METHOD_POST, Url: "downloads/add/", }
AddDownloadEP endpoint definition Output: Download
View Source
var AuthorizeEP = &Endpoint{ Verb: HTTP_METHOD_POST, Url: "login/authorize", BodyRequired: true, }
View Source
var ConnectionEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "connection/", }
View Source
var ConnectionLogEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "connection/logs/", }
Undocumented
View Source
var CurrentFTPConfigEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "ftp/config/", }
View Source
var DeleteDownloadEP = &Endpoint{ Verb: HTTP_METHOD_DELETE, Url: "downloads/{{.id}}/", }
DeleteDownloadEP endpoint definition
View Source
var DlEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "dl/{{.path}}", }
View Source
var DownloadsEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "downloads/", }
DownloadsEP endpoint definition Output: []Download
View Source
var EraseDownloadEP = &Endpoint{ Verb: HTTP_METHOD_DELETE, Url: "downloads/{{.id}}/erase", }
EraseDownloadEP endpoint definition
View Source
var InfoEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "fs/info/{{.path}}", }
View Source
var InterfaceEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "lan/browser/{{.iface}}/", }
InterfaceEP endpoint definition Output: []LanHost
View Source
var InterfaceHostEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "lan/browser/{{.iface}}/{{.host_id}}", }
InterfaceHostEP endpoint definition Output: LanHost
View Source
var InterfacesEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "lan/browser/interfaces/", }
InterfacesEP endpoint definition Output: []InterfaceStat
View Source
var LanConfigEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "lan/config/", }
LanConfigEP endpoint definition Output: LanConfig
View Source
var LoginEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "login/", }
View Source
var LogoutEP = &Endpoint{ Verb: HTTP_METHOD_POST, Url: "login/logout/", }
View Source
var LsEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "fs/ls/{{.path}}", }
View Source
var RebootEP = &Endpoint{ Verb: HTTP_METHOD_POST, Url: "system/reboot/", }
View Source
var SessionEP = &Endpoint{ Verb: HTTP_METHOD_POST, Url: "login/session/", }
View Source
Verb: HTTP_METHOD_POST, Url: "share_link/", }
View Source
var SystemEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "system/", }
View Source
var TasksEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "fs/tasks/", }
View Source
var TrackAuthorizeEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "login/authorize/{{.track_id}}", }
View Source
var UlEP = &Endpoint{ Verb: HTTP_METHOD_GET, Url: "ws/upload", }
View Source
var UpdateFTPConfigEP = &Endpoint{ Verb: HTTP_METHOD_PUT, Url: "ftp/config/", BodyRequired: true, }
View Source
var WakeOnLanEP = &Endpoint{ Verb: HTTP_METHOD_POST, Url: "lan/wol/{{.iface}}/", BodyRequired: true, }
WakeOnLanEP endpoint definition Output: nil
Functions ¶
func APIVersionToInt ¶
func ComputePassword ¶
func EncodePath ¶
func EndpointTester ¶
func MdnsDiscover ¶
func MdnsDiscover(fbChan chan<- *Freebox)
func ResultFromResponse ¶
func ResultFromResponse(resp *APIResponse, result interface{}) (err error)
Types ¶
type APIResponse ¶
type APIVersion ¶
type APIVersion struct {
UID string `json:"uid"`
DeviceName string `json:"device_name"`
DeviceType string `json:"device_type"`
APIBaseURL string `json:"api_base_url"`
APIVersion string `json:"api_version"`
RemoteHTTPSAvailable bool `json:"https_available"`
RemoteHTTPSPort int `json:"https_port"`
RemoteAPIDomain string `json:"api_domain"`
}
type Authorization ¶
type AuthorizationState ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Register ¶
func (c *Client) Register(tokenReq *TokenRequest) (respAuth *Authorization, err error)
func (*Client) Session ¶
func (c *Client) Session(reqSess ReqSession) (respSess *RespSession, err error)
func (*Client) WithSession ¶
type ConnectionLog ¶
type ConnectionLog struct {
State string `json:"state"`
Type string `json:"type"`
BandwidthDown int `json:"bw_down,omitempty"`
BandwidthUp int `json:"bw_up,omitempty"`
Link string `json:"link,omitempty"`
ID int `json:"id"`
Date int `json:"date"`
Conn string `json:"conn,omitempty"`
}
Undocumented
type ConnectionStatus ¶
type ConnectionStatus struct {
State string `json:"state"`
Type string `json:"type"`
Media string `json:"media"`
Ipv4 string `json:"ipv4"`
Ipv6 string `json:"ipv6"`
RateUp int `json:"rate_up"`
RateDown int `json:"rate_down"`
BandwidthUp int `json:"bandwidth_up"`
BandwidthDown int `json:"bandwidth_down"`
BytesUp int `json:"bytes_up"`
BytesDown int `json:"bytes_down"`
Ipv4PortRange [2]int `json:"ipv4_port_range"`
}
type Download ¶
type Download struct {
ID int `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
Status string `json:"status"`
Size int `json:"size"`
QueuePos int `json:"queue_pos"`
IOPriority string `json:"io_priority"`
TXBytes int `json:"tx_bytes"`
RXBytes int `json:"rx_bytes"`
TXRate int `json:"tx_rate"`
RXRate int `json:"rx_rate"`
TXPct int `json:"tx_pct"`
RXPct int `json:"rx_pct"`
Error string `json:"error"`
CreatedTS int `json:"created_ts"`
ETA int `json:"eta"`
DownloadDir string `json:"download_dir"`
StopRatio int `json:"stop_ratio"`
ArchivePassword string `json:"stop_ratio"`
InfoHash string `json:"info_hash"`
PieceLength int `json:"piece_length"`
}
type DownloadReq ¶
type DownloadReq struct {
DownloadUrl string `json:"download_url,omitempty"`
DownloadUrlList string `json:"download_url_list,omitempty"`
DownloadDir string `json:"download_dir"`
Recursive bool `json:"recursive,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
ArchivePassword string `json:"archive_password,omitempty"`
Cookies string `json:"cookies,omitempty"`
}
type DownloadTask ¶
type DownloadTask struct {
ID int `json:"id"`
}
type FSTask ¶
type FSTask struct {
ID int `json:"id"`
Type string `json:"type"`
State string `json:"state"`
Error string `json:"error"`
CreatedTS int `json:"created_ts"`
StartedTS int `json:"started_ts"`
DoneTS int `json:"done_ts"`
Duration int `json:"duration"`
Progress int `json:"progress"`
ETA int `json:"eta"`
From string `json:"from"`
To string `json:"to"`
NFiles int `json:"nfiles"`
NFilesDone int `json:"nfiles_done"`
TotalBytes int `json:"total_bytes"`
TotalBytesDone int `json:"total_bytes_done"`
CurrBytes int `json:"curr_bytes"`
Rate int `json:"rate"`
}
type FTPConfig ¶
type FTPConfig struct {
Enabled bool `json:"enabled"`
AllowAnonymous bool `json:"allow_anonymous"`
AllowAnonymousWrite bool `json:"allow_anonymous_write"`
WeakPassword bool `json:"weak_password"`
AllowRemoteAccess bool `json:"allow_remote_access"`
PortCtrl int `json:"port_ctrl"`
PortData int `json:"port_data"`
RemoteDomain string `json:"remote_domain"`
}
type FileInfo ¶
type FileInfo struct {
Path string `json:"path"`
Name string `json:"name"`
MimeType string `json:"mimetype"`
Type string `json:"type"`
Size int `json:"size"`
Modification int `json:"modification"`
Index int `json:"index"`
Link bool `json:"link"`
Target string `json:"target"`
Hidden bool `json:"hidden"`
FolderCount int `json:"foldercount"`
FileCount int `json:"filecount"`
Parent string `json:"parent"`
}
type FileUpload ¶
type FileUploadChunkResponse ¶
type FileUploadChunkResponse struct {
WSResponse
Result FileUploadChunkResult `json:"result,omitempty"`
}
type FileUploadChunkResult ¶
type FileUploadStartAction ¶
type Freebox ¶
type Freebox struct {
Host string
Port int
APIVersion
Authorization
}
func NewFreebox ¶
func NewFromServiceEntry ¶
func NewFromServiceEntry(service *mdns.ServiceEntry) (fb *Freebox)
func (*Freebox) NewSession ¶
type InterfaceStat ¶
type LanHost ¶
type LanHost struct {
ID string `json:"id"`
PrimaryName string `json:"primary_name"`
HostType string `json:"host_type"`
PrimaryNameManual bool `json:"primary_name_manual"`
L2Ident LanHostL2Ident `json:"l2ident"`
VendorName string `json:"vendor_name"`
Persistent bool `json:"persistent"`
Reachable bool `json:"reachable"`
LastTimeReachable int `json:"last_time_reachable"`
Active bool `json:"active"`
LastActivity int `json:"last_activity"`
Names []LanHostName `json:"names"`
L3Connectivities []LanHostL3Connectivity `json:"l3connectivities"`
Interface string `json:"interface"` // not documented
}
type LanHostL2Ident ¶
type LanHostL3Connectivity ¶
type LanHostName ¶
type Query ¶
func (Query) Inspect ¶
func (q Query) Inspect(resp *APIResponse) Query
func (Query) WithFormBody ¶
type ReqSession ¶
type RespSession ¶
type Session ¶
type Session struct {
*APIVersion
*RespSession
Version int
}
type SystemConfig ¶
type SystemConfig struct {
FirmwareVersion string `json:"firmware_version"`
Mac string `json:"mac"`
Serial string `json:"serial"`
Uptime string `json:"uptime"`
UptimeVal int `json:"uptime_val"`
BoardName string `json:"board_name"`
TempCPUm int `json:"temp_cpum"`
TempSW int `json:"temp_sw"`
TempCPUb int `json:"temp_cpub"`
FanRPM int `json:"fan_rpm"`
BoxAuthenticated bool `json:"box_authenticated"`
DiskStatus string `json:"disk_status"`
BoxFlavor string `json:"box_flavor"`
UserMainStorage string `json:"user_main_storage"`
}
type TokenRequest ¶
type WSNotification ¶
type WSResponse ¶
Click to show internal directories.
Click to hide internal directories.