Documentation ¶
Index ¶
- Constants
- Variables
- func AllowMethods(w http.ResponseWriter, r *http.Request, methods ...string) bool
- func ETagFor(data []byte) string
- func GetJSONBody(w http.ResponseWriter, r *http.Request, v interface{}) bool
- func IsContentType(r *http.Request, t string) bool
- func Must(err error)
- func MustMarshalJSON(v interface{}) []byte
- func MustMarshalProto(v proto.Message) []byte
- func MustUnmarshalJSON(raw []byte, v interface{})
- func MustUnmarshalProto(raw []byte, v proto.Message)
- func RenderHTML(w http.ResponseWriter, r *http.Request, name string, page *Page, ...)
- type BlobHandler
- type BlobReference
- type CloudServer
- type Group
- type GroupDelta
- type GroupHandler
- func (h GroupHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
- func (h GroupHandler) DeleteGroup(w http.ResponseWriter, r *http.Request, groupId uint64, groupName string)
- func (h GroupHandler) GetGroup(w http.ResponseWriter, r *http.Request, groupId uint64, groupName string)
- func (h GroupHandler) ListGroups(w http.ResponseWriter, r *http.Request)
- func (h GroupHandler) PutGroup(w http.ResponseWriter, r *http.Request, groupId uint64, groupName string)
- func (h GroupHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type GroupLifetime
- type HomeHandler
- type KeepAliveListener
- type Page
- type StaticHandler
- type UnproxyHandler
- type User
- type UserDelta
- type UserHandler
- func (h UserHandler) CreateUser(w http.ResponseWriter, r *http.Request)
- func (h UserHandler) DeleteUser(w http.ResponseWriter, r *http.Request, userId uint64, userName string)
- func (h UserHandler) GetUser(w http.ResponseWriter, r *http.Request, userId uint64, userName string)
- func (h UserHandler) ListUsers(w http.ResponseWriter, r *http.Request)
- func (h UserHandler) PutUser(w http.ResponseWriter, r *http.Request, userId uint64, userName string)
- func (h UserHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type UserLifetime
Constants ¶
View Source
const ( OPTIONS = "OPTIONS" GET = "GET" HEAD = "HEAD" POST = "POST" PUT = "PUT" DELETE = "DELETE" TRACE = "TRACE" CONNECT = "CONNECT" PATCH = "PATCH" )
HTTP Methods
View Source
const ( Accept = "Accept" AcceptCharset = "Accept-Charset" AcceptEncoding = "Accept-Encoding" AcceptLanguage = "Accept-Language" AcceptRanges = "Accept-Ranges" Allow = "Allow" Authorization = "Authorization" CacheControl = "Cache-Control" Connection = "Connection" ContentEncoding = "Content-Encoding" ContentLanguage = "Content-Language" ContentLength = "Content-Length" ContentLocation = "Content-Location" ContentMD5 = "Content-Md5" ContentRange = "Content-Range" ContentType = "Content-Type" Date = "Date" ETag = "Etag" Expect = "Expect" Expires = "Expires" Forwarded = "Forwarded" Host = "Host" IfMatch = "If-Match" IfModifiedSince = "If-Modified-Since" IfNoneMatch = "If-None-Match" IfRange = "If-Range" IfUnmodifiedSince = "If-Unmodified-Since" LastModified = "Last-Modified" Location = "Location" Referer = "Referer" // sic RetryAfter = "Retry-After" Server = "Server" TE = "TE" Trailer = "Trailer" TransferEncoding = "Transfer-Encoding" Upgrade = "Upgrade" UserAgent = "User-Agent" Vary = "Vary" Via = "Via" Warning = "Warning" XForwardedFor = "X-Forwarded-For" XForwardedHost = "X-Forwarded-Host" XForwardedProto = "X-Forwarded-Proto" )
HTTP Headers
View Source
const ( CacheControlNoCache = "no-cache" CacheControlPrivate = "private, max-age=86400" CacheControlPublic = "public, max-age=86400" )
Values for the HTTP "Cache-Control" Header
View Source
const ( MediaTypeJS = "application/javascript" MediaTypeJSON = "application/json" MediaTypeWwwForm = "application/x-www-form-urlencoded" MediaTypeXML = "application/xml" MediaTypeCSS = "text/css; charset=utf-8" MediaTypeHTML = "text/html; charset=utf-8" MediaTypeText = "text/plain; charset=utf-8" MediaTypeGIF = "image/gif" MediaTypeICO = "image/x-icon" MediaTypeJPEG = "image/jpeg" MediaTypePNG = "image/png" MediaTypeBinary = "application/octet-stream" )
Values for the HTTP "Content-Type" Header
Variables ¶
View Source
var StaticHandlers []*StaticHandler
Functions ¶
func AllowMethods ¶
func GetJSONBody ¶
func GetJSONBody(w http.ResponseWriter, r *http.Request, v interface{}) bool
func MustMarshalJSON ¶
func MustMarshalJSON(v interface{}) []byte
func MustMarshalProto ¶
func MustUnmarshalJSON ¶
func MustUnmarshalJSON(raw []byte, v interface{})
func MustUnmarshalProto ¶
func RenderHTML ¶
Types ¶
type BlobHandler ¶
type BlobHandler struct {
// contains filtered or unexported fields
}
func (BlobHandler) CreateBlob ¶
func (h BlobHandler) CreateBlob(w http.ResponseWriter, r *http.Request)
func (BlobHandler) GetBlob ¶
func (h BlobHandler) GetBlob(w http.ResponseWriter, r *http.Request, blobId uint64)
func (BlobHandler) ListBlobs ¶
func (h BlobHandler) ListBlobs(w http.ResponseWriter, r *http.Request)
func (BlobHandler) ServeHTTP ¶
func (h BlobHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type BlobReference ¶
type BlobReference struct {
Id uint64 `json:"id"`
}
type CloudServer ¶
func New ¶
func New(dir string) (*CloudServer, error)
func (*CloudServer) Close ¶
func (srv *CloudServer) Close() error
func (*CloudServer) ListenAndServe ¶
func (srv *CloudServer) ListenAndServe(proto, laddr string) error
func (*CloudServer) Stop ¶
func (srv *CloudServer) Stop()
type Group ¶
type Group struct { Id uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` GroupName string `protobuf:"bytes,2,opt,name=group_name" json:"group_name,omitempty"` Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` Users []uint64 `protobuf:"varint,4,rep,name=users" json:"users,omitempty"` }
func (*Group) ProtoMessage ¶
func (*Group) ProtoMessage()
type GroupDelta ¶
type GroupDelta struct { GroupName *string `json:"group_name"` Description *string `json:"description"` Users *[]uint64 `json:"users"` }
func (*GroupDelta) Apply ¶
func (d *GroupDelta) Apply(g *Group)
func (*GroupDelta) Validate ¶
func (d *GroupDelta) Validate(lifetime GroupLifetime) error
type GroupHandler ¶
func (GroupHandler) CreateGroup ¶
func (h GroupHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
func (GroupHandler) DeleteGroup ¶
func (h GroupHandler) DeleteGroup(w http.ResponseWriter, r *http.Request, groupId uint64, groupName string)
func (GroupHandler) GetGroup ¶
func (h GroupHandler) GetGroup(w http.ResponseWriter, r *http.Request, groupId uint64, groupName string)
func (GroupHandler) ListGroups ¶
func (h GroupHandler) ListGroups(w http.ResponseWriter, r *http.Request)
func (GroupHandler) PutGroup ¶
func (h GroupHandler) PutGroup(w http.ResponseWriter, r *http.Request, groupId uint64, groupName string)
func (GroupHandler) ServeHTTP ¶
func (h GroupHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type GroupLifetime ¶
type GroupLifetime bool
const ( NewGroup GroupLifetime = false ExistingGroup GroupLifetime = true )
type HomeHandler ¶
type HomeHandler struct{}
func (HomeHandler) ServeHTTP ¶
func (h HomeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type KeepAliveListener ¶
func (KeepAliveListener) Addr ¶
func (l KeepAliveListener) Addr() net.Addr
func (KeepAliveListener) Close ¶
func (l KeepAliveListener) Close() error
type StaticHandler ¶
func (*StaticHandler) ServeHTTP ¶
func (h *StaticHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type UnproxyHandler ¶
func (UnproxyHandler) ServeHTTP ¶
func (handler UnproxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type User ¶
type User struct { Id uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` UserName string `protobuf:"bytes,2,opt,name=user_name" json:"user_name,omitempty"` DisplayName string `protobuf:"bytes,3,opt,name=display_name" json:"display_name,omitempty"` EMail string `protobuf:"bytes,4,opt,name=email" json:"email,omitempty"` URL string `protobuf:"bytes,5,opt,name=url" json:"url,omitempty"` }
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
type UserDelta ¶
type UserDelta struct { UserName *string `json:"user_name"` DisplayName *string `json:"display_name"` EMail *string `json:"email"` URL *string `json:"url"` }
func (*UserDelta) Validate ¶
func (d *UserDelta) Validate(lifetime UserLifetime) error
type UserHandler ¶
func (UserHandler) CreateUser ¶
func (h UserHandler) CreateUser(w http.ResponseWriter, r *http.Request)
func (UserHandler) DeleteUser ¶
func (h UserHandler) DeleteUser(w http.ResponseWriter, r *http.Request, userId uint64, userName string)
func (UserHandler) GetUser ¶
func (h UserHandler) GetUser(w http.ResponseWriter, r *http.Request, userId uint64, userName string)
func (UserHandler) ListUsers ¶
func (h UserHandler) ListUsers(w http.ResponseWriter, r *http.Request)
func (UserHandler) PutUser ¶
func (h UserHandler) PutUser(w http.ResponseWriter, r *http.Request, userId uint64, userName string)
func (UserHandler) ServeHTTP ¶
func (h UserHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type UserLifetime ¶
type UserLifetime bool
const ( NewUser UserLifetime = false ExistingUser UserLifetime = true )
Click to show internal directories.
Click to hide internal directories.