Documentation ¶
Index ¶
- Constants
- func NewHandler(server Server) *goji.Mux
- type Blob
- type HtpasswdFile
- type Server
- func (s *Server) AuthHandler(f *HtpasswdFile, h http.Handler) http.HandlerFunc
- func (s *Server) CheckBlob(w http.ResponseWriter, r *http.Request)
- func (s *Server) CheckConfig(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateRepo(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteBlob(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteConfig(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetBlob(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetConfig(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListBlobs(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListBlobsV1(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListBlobsV2(w http.ResponseWriter, r *http.Request)
- func (s *Server) SaveBlob(w http.ResponseWriter, r *http.Request)
- func (s *Server) SaveConfig(w http.ResponseWriter, r *http.Request)
Constants ¶
const CheckInterval = 30 * time.Second
CheckInterval represents how often we check for changes in htpasswd file.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶ added in v0.9.8
NewHandler returns the master HTTP multiplexer/router.
Types ¶
type HtpasswdFile ¶
HtpasswdFile is a map for usernames to passwords.
func NewHtpasswdFromFile ¶
func NewHtpasswdFromFile(path string) (*HtpasswdFile, error)
NewHtpasswdFromFile reads the users and passwords from a htpasswd file and returns them. If an error is encountered, it is returned, together with a nil-Pointer for the HtpasswdFile.
func (*HtpasswdFile) Reload ¶ added in v0.9.6
func (h *HtpasswdFile) Reload() error
Reload reloads the htpasswd file. If the reload fails, the Users map is not changed and the error is returned.
func (*HtpasswdFile) ReloadCheck ¶ added in v0.9.6
func (h *HtpasswdFile) ReloadCheck() error
ReloadCheck checks at most once per CheckInterval if the file changed and will reload the file if it did. It logs errors and successful reloads, and returns an error if any was encountered.
type Server ¶ added in v0.9.8
type Server struct { Path string Listen string Log string CPUProfile string TLSKey string TLSCert string TLS bool NoAuth bool AppendOnly bool PrivateRepos bool Prometheus bool Debug bool MaxRepoSize int64 // contains filtered or unexported fields }
Server determines how a Mux's handlers behave.
func (*Server) AuthHandler ¶ added in v0.9.8
func (s *Server) AuthHandler(f *HtpasswdFile, h http.Handler) http.HandlerFunc
AuthHandler wraps h with a http.HandlerFunc that performs basic authentication against the user/passwords pairs stored in f and returns the http.HandlerFunc.
func (*Server) CheckBlob ¶ added in v0.9.8
func (s *Server) CheckBlob(w http.ResponseWriter, r *http.Request)
CheckBlob tests whether a blob exists.
func (*Server) CheckConfig ¶ added in v0.9.8
func (s *Server) CheckConfig(w http.ResponseWriter, r *http.Request)
CheckConfig checks whether a configuration exists.
func (*Server) CreateRepo ¶ added in v0.9.8
func (s *Server) CreateRepo(w http.ResponseWriter, r *http.Request)
CreateRepo creates repository directories.
func (*Server) DeleteBlob ¶ added in v0.9.8
func (s *Server) DeleteBlob(w http.ResponseWriter, r *http.Request)
DeleteBlob deletes a blob from the repository.
func (*Server) DeleteConfig ¶ added in v0.9.8
func (s *Server) DeleteConfig(w http.ResponseWriter, r *http.Request)
DeleteConfig removes a config.
func (*Server) GetBlob ¶ added in v0.9.8
func (s *Server) GetBlob(w http.ResponseWriter, r *http.Request)
GetBlob retrieves a blob from the repository.
func (*Server) GetConfig ¶ added in v0.9.8
func (s *Server) GetConfig(w http.ResponseWriter, r *http.Request)
GetConfig allows for a config to be retrieved.
func (*Server) ListBlobs ¶ added in v0.9.8
func (s *Server) ListBlobs(w http.ResponseWriter, r *http.Request)
ListBlobs lists all blobs of a given type in an arbitrary order.
func (*Server) ListBlobsV1 ¶ added in v0.9.8
func (s *Server) ListBlobsV1(w http.ResponseWriter, r *http.Request)
ListBlobsV1 lists all blobs of a given type in an arbitrary order.
func (*Server) ListBlobsV2 ¶ added in v0.9.8
func (s *Server) ListBlobsV2(w http.ResponseWriter, r *http.Request)
ListBlobsV2 lists all blobs of a given type, together with their sizes, in an arbitrary order.
func (*Server) SaveBlob ¶ added in v0.9.8
func (s *Server) SaveBlob(w http.ResponseWriter, r *http.Request)
SaveBlob saves a blob to the repository.
func (*Server) SaveConfig ¶ added in v0.9.8
func (s *Server) SaveConfig(w http.ResponseWriter, r *http.Request)
SaveConfig allows for a config to be saved.