Documentation
¶
Index ¶
- Variables
- type Authorization
- type Credential
- type ErrInvalidAuthorizationHeader
- type ErrInvalidCredential
- type Error
- type ErrorCode
- type Method
- type Object
- type RequestContext
- type Server
- func (s *Server) GetBucketLocation(ctx *RequestContext) *Error
- func (s *Server) GetObject(ctx *RequestContext) *Error
- func (s *Server) HeadBucket(ctx *RequestContext) *Error
- func (s *Server) HeadObject(ctx *RequestContext) *Error
- func (s *Server) ListObjectsV2(ctx *RequestContext) *Error
- func (s *Server) ServeHTTP(rw http.ResponseWriter, r *http.Request)
- type Signer
- func (s *Signer) CanonicalRequest(r *http.Request, hashedPayload []byte, signedHeaders []string) []byte
- func (s *Signer) RequestDate(r *http.Request) (time.Time, error)
- func (s *Signer) SigningKey(at time.Time) []byte
- func (s *Signer) StringToSign(at time.Time, canonicalRequest []byte) []byte
- func (s *Signer) Verify(r *http.Request) ([]byte, error)
- type WrappedError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AccessDenied = ErrorCode{Code: "AccessDenied", StatusCode: 403} InvalidAccessKeyId = ErrorCode{Code: "InvalidAccessKeyId", StatusCode: 403} SignatureDoesNotMatch = ErrorCode{Code: "SignatureDoesNotMatch", StatusCode: 403} MethodNotAllowed = ErrorCode{Code: "MethodNotAllowed", StatusCode: 405} InvalidRequest = ErrorCode{Code: "InvalidRequest", StatusCode: 400} ExpiredToken = ErrorCode{Code: "ExpiredToken", StatusCode: 400} InvalidArgument = ErrorCode{Code: "InvalidArgument", StatusCode: 400} BadDigest = ErrorCode{Code: "BadDigest", StatusCode: 400} NoSuchKey = ErrorCode{Code: "NoSuchKey", StatusCode: 404} MissingSecurityHeader = ErrorCode{Code: "MissingSecurityHeader", StatusCode: 400} InvalidToken = ErrorCode{Code: "InvalidToken", StatusCode: 400} InvalidObjectState = ErrorCode{Code: "InvalidObjectState", StatusCode: 403} InvalidRange = ErrorCode{Code: "InvalidRange", StatusCode: 416} InvalidBucketName = ErrorCode{Code: "InvalidBucketName", StatusCode: 400} NotImplemented = ErrorCode{Code: "NotImplemented", StatusCode: 501} )
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorization struct {
Method []byte
Credentials Credential
SignedHeaders []string
Signature []byte // raw decoded hex
}
func ParseAuthorization ¶
func ParseAuthorization(hdr []byte) (*Authorization, error)
ParseAuthorization parses the contents of the given Authorization header. Returns a non-nil *ErrInvalidAuthorizationHeader when an invalid header is given.
func (Authorization) AppendFormat ¶
func (a Authorization) AppendFormat(b []byte) []byte
type Credential ¶
type Credential struct {
AccessKeyID []byte
Date time.Time
Region []byte
Service []byte
Method []byte
}
func ParseCredential ¶
func ParseCredential(value []byte) (*Credential, error)
func (Credential) AppendFormat ¶
func (c Credential) AppendFormat(b []byte) []byte
type ErrInvalidAuthorizationHeader ¶
type ErrInvalidAuthorizationHeader struct {
WrappedError
}
func (*ErrInvalidAuthorizationHeader) Error ¶
func (e *ErrInvalidAuthorizationHeader) Error() string
type ErrInvalidCredential ¶
type ErrInvalidCredential struct {
WrappedError
}
func (*ErrInvalidCredential) Error ¶
func (e *ErrInvalidCredential) Error() string
type Method ¶
type Method func(ctx *RequestContext) *Error
type Object ¶
type Object struct {
io.ReadCloser
Size int64
Range *http_range.Range
LastModified time.Time
}
type RequestContext ¶
type RequestContext struct {
*zap.Logger
*http.Request
ID uuid.UUID
Bucket string
// contains filtered or unexported fields
}
func (*RequestContext) Header ¶
func (ctx *RequestContext) Header() http.Header
func (*RequestContext) SendKnownError ¶
func (ctx *RequestContext) SendKnownError(err *Error)
SendKnownError replies to the caller with a concrete *Error type using the standard Amazon S3 XML error encoding.
func (*RequestContext) SendXML ¶
func (ctx *RequestContext) SendXML(statusCode int, payload any)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GetBucketLocation ¶
func (s *Server) GetBucketLocation(ctx *RequestContext) *Error
func (*Server) GetObject ¶
func (s *Server) GetObject(ctx *RequestContext) *Error
func (*Server) HeadBucket ¶
func (s *Server) HeadBucket(ctx *RequestContext) *Error
func (*Server) HeadObject ¶
func (s *Server) HeadObject(ctx *RequestContext) *Error
func (*Server) ListObjectsV2 ¶
func (s *Server) ListObjectsV2(ctx *RequestContext) *Error
type Signer ¶
type Signer struct {
Region string
AccessKeyID string
SecretAccessKey string
MaxCredentialValidity time.Duration
}
func (*Signer) CanonicalRequest ¶
func (*Signer) StringToSign ¶
type WrappedError ¶
type WrappedError struct {
Cause error
}
func (WrappedError) Unwrap ¶
func (e WrappedError) Unwrap() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.