Documentation
¶
Index ¶
- func New(config Config) *server
- func Start(config Config)
- type Client
- type Config
- type ConnectionRequest
- type ConnectionResponse
- type DownloadRequest
- type DownloadResponse
- type MessageType
- type NotificationType
- type Repository
- type Request
- type RequestHandler
- type SearchRequest
- type SearchResponse
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
type Config ¶
type Config struct { Log bool Port string UserName string Persist bool DownloadDir string Basepath string Server string EnableTLS bool SearchTimeout time.Duration SearchBot string DisableBrowserDownloads bool UserAgent string }
Config contains settings for server
type ConnectionRequest ¶
type ConnectionRequest struct{}
ConnectionRequest is a request to start the IRC server
type ConnectionResponse ¶
type ConnectionResponse struct { StatusResponse Name string `json:"name"` }
ConnectionResponse
type DownloadRequest ¶
type DownloadRequest struct {
Book string `json:"book"`
}
DownloadRequest is a request to download a specific book from the IRC server
type DownloadResponse ¶
type DownloadResponse struct { StatusResponse Name string `json:"name"` DownloadPath string `json:"downloadPath"` }
DownloadResponse is a response that sends the requested book to the client
type MessageType ¶
type MessageType int
const ( STATUS MessageType = iota CONNECT SEARCH DOWNLOAD RATELIMIT )
Available commands. These are sent via integers starting at 1
func (MessageType) String ¶
func (i MessageType) String() string
type NotificationType ¶
type NotificationType int
const ( NOTIFY NotificationType = iota SUCCESS WARNING DANGER )
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository() *Repository
type Request ¶
type Request struct { MessageType MessageType `json:"type"` Payload json.RawMessage `json:"payload"` }
Request in a generic structure for all requests from the websocket client
type RequestHandler ¶
type RequestHandler interface {
// contains filtered or unexported methods
}
RequestHandler defines a generic handle() method that is called when a specific request type is made
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"query"`
}
SearchRequest is a request that sends a search request to the IRC server for a specific query
type SearchResponse ¶
type SearchResponse struct { StatusResponse Books []core.BookDetail `json:"books"` Errors []core.ParseError `json:"errors"` }
SearchResponse is a response that is sent containing BookDetails objects that matched the query
type StatusResponse ¶
type StatusResponse struct { MessageType MessageType `json:"type"` NotificationType NotificationType `json:"appearance"` Title string `json:"title"` Detail string `json:"detail"` }