Documentation ¶
Index ¶
- func AddContext(next http.Handler, option *ServerOptions) http.Handler
- func Execute()
- func GetJSONServers() map[string]string
- func GetProviders() (providers []string)
- func GetRootCmd() *cobra.Command
- func HandleDefaultProvider(w http.ResponseWriter, r *http.Request)
- func HandleJSONServers(w http.ResponseWriter, r *http.Request)
- func HandleProviders(w http.ResponseWriter, r *http.Request)
- func HandleUpdateCenter(w http.ResponseWriter, r *http.Request)
- type CacheServer
- type FileSystemCacheServer
- type QuerySource
- type ServerOptions
- func (o *ServerOptions) GetAndCacheURL(query UpdateCenterQuery) (targetURL *url.URL, err error)
- func (o *ServerOptions) GetProviderURL(official *url.URL, query UpdateCenterQuery) (targetURL string)
- func (o *ServerOptions) GetURL(version string) (targetURL *url.URL, err error)
- func (o *ServerOptions) Run(cmd *cobra.Command, args []string) (err error)
- type UpdateCenterQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContext ¶ added in v0.0.2
func AddContext(next http.Handler, option *ServerOptions) http.Handler
AddContext add context inject all handlers
func GetJSONServers ¶ added in v0.0.2
GetJSONServers get all JSON servers
func GetProviders ¶ added in v0.0.2
func GetProviders() (providers []string)
GetProviders get all providers
func GetRootCmd ¶ added in v0.0.2
GetRootCmd returns the root command
func HandleDefaultProvider ¶ added in v0.0.2
func HandleDefaultProvider(w http.ResponseWriter, r *http.Request)
HandleDefaultProvider handle /providers/default
func HandleJSONServers ¶ added in v0.0.2
func HandleJSONServers(w http.ResponseWriter, r *http.Request)
HandleJSONServers handle /json-servers
func HandleProviders ¶ added in v0.0.2
func HandleProviders(w http.ResponseWriter, r *http.Request)
HandleProviders handle /providers
func HandleUpdateCenter ¶ added in v0.0.2
func HandleUpdateCenter(w http.ResponseWriter, r *http.Request)
HandleUpdateCenter handle GET /update-center.json
Types ¶
type CacheServer ¶
CacheServer is the interface for saving a cache item
type FileSystemCacheServer ¶
type FileSystemCacheServer struct { FileName string // contains filtered or unexported fields }
FileSystemCacheServer save the cache into a filesystem
func (*FileSystemCacheServer) Load ¶
func (c *FileSystemCacheServer) Load(key string) (val string)
Load load the key from a file
type QuerySource ¶ added in v0.0.2
QuerySource which contains the methods to query
type ServerOptions ¶
type ServerOptions struct { Config string DefaultProvider string DefaultJSONServer string Host string Port int PortLTS int CertFile string KeyFile string Printer helper.Printer }
ServerOptions represents the options for a server
func (*ServerOptions) GetAndCacheURL ¶
func (o *ServerOptions) GetAndCacheURL(query UpdateCenterQuery) (targetURL *url.URL, err error)
GetAndCacheURL get the real URL, then cache it
func (*ServerOptions) GetProviderURL ¶ added in v0.0.2
func (o *ServerOptions) GetProviderURL(official *url.URL, query UpdateCenterQuery) (targetURL string)
GetProviderURL get the update center URL from a provider
type UpdateCenterQuery ¶ added in v0.0.2
type UpdateCenterQuery struct { Version string Provider string JSONServer string Experimental bool }
UpdateCenterQuery holds the info for query a update center
func GetUpdateCenterQuery ¶ added in v0.0.2
func GetUpdateCenterQuery(querySources ...QuerySource) (query UpdateCenterQuery)
GetUpdateCenterQuery returns the query object