Documentation
¶
Index ¶
- Constants
- func Decode(input string) int64
- func Encode(number int64) string
- func LoveHandler(h http.Handler) http.HandlerFunc
- func RenderFloat(format string, n float64) string
- func RenderInteger(format string, n int) string
- type GDrive
- func (s *GDrive) Delete(token string, filename string) (err error)
- func (s *GDrive) Get(token string, filename string) (reader io.ReadCloser, contentType string, contentLength uint64, err error)
- func (s *GDrive) Head(token string, filename string) (contentType string, contentLength uint64, err error)
- func (s *GDrive) IsNotExist(err error) bool
- func (s *GDrive) Put(token string, filename string, reader io.Reader, contentType string, ...) error
- func (s *GDrive) Type() string
- type LocalStorage
- func (s *LocalStorage) Delete(token string, filename string) (err error)
- func (s *LocalStorage) Get(token string, filename string) (reader io.ReadCloser, contentType string, contentLength uint64, err error)
- func (s *LocalStorage) Head(token string, filename string) (contentType string, contentLength uint64, err error)
- func (s *LocalStorage) IsNotExist(err error) bool
- func (s *LocalStorage) Put(token string, filename string, reader io.Reader, contentType string, ...) error
- func (s *LocalStorage) Type() string
- type Metadata
- type OptionFn
- func ClamavHost(s string) OptionFn
- func EnableProfiler() OptionFn
- func ForceHTTPs() OptionFn
- func GoogleAnalytics(gaKey string) OptionFn
- func HttpAuthCredentials(user string, pass string) OptionFn
- func Listener(s string) OptionFn
- func LogFile(logger *log.Logger, s string) OptionFn
- func Logger(logger *log.Logger) OptionFn
- func ProfileListener(s string) OptionFn
- func RateLimit(requests int) OptionFn
- func TLSConfig(cert, pk string) OptionFn
- func TLSListener(s string, t bool) OptionFn
- func TempPath(s string) OptionFn
- func UseLetsEncrypt(hosts []string) OptionFn
- func UseStorage(s Storage) OptionFn
- func UserVoice(userVoiceKey string) OptionFn
- func VirustotalKey(s string) OptionFn
- func WebPath(s string) OptionFn
- type S3Storage
- func (s *S3Storage) Delete(token string, filename string) (err error)
- func (s *S3Storage) Get(token string, filename string) (reader io.ReadCloser, contentType string, contentLength uint64, err error)
- func (s *S3Storage) Head(token string, filename string) (contentType string, contentLength uint64, err error)
- func (s *S3Storage) IsNotExist(err error) bool
- func (s *S3Storage) Put(token string, filename string, reader io.Reader, contentType string, ...) (err error)
- func (s *S3Storage) Type() string
- type Server
- func (s *Server) BasicAuthHandler(h http.Handler) http.HandlerFunc
- func (s *Server) CheckDeletionToken(deletionToken, token, filename string) error
- func (s *Server) CheckMetadata(token, filename string) error
- func (s *Server) Lock(token, filename string) error
- func (s *Server) RedirectHandler(h http.Handler) http.HandlerFunc
- func (s *Server) Run()
- func (s *Server) Unlock(token, filename string) error
- type Storage
Constants ¶
View Source
const ( // characters used for short-urls SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // someone set us up the bomb !! BASE = int64(len(SYMBOLS)) )
View Source
const GDriveDirectoryMimeType = "application/vnd.google-apps.folder"
View Source
const GDriveRootConfigFile = "root_id.conf"
View Source
const GDriveTokenJsonFile = "token.json"
View Source
const SERVER_INFO = "transfer.sh"
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decodes a string given in our encoding and returns the decimal integer.
func Encode ¶
encodes a number into our *base* representation TODO can this be made better with some bitshifting?
func LoveHandler ¶
func LoveHandler(h http.Handler) http.HandlerFunc
Create a log handler for every request it receives.
Types ¶
type GDrive ¶
type GDrive struct {
// contains filtered or unexported fields
}
func NewGDriveStorage ¶
func (*GDrive) Get ¶
func (*GDrive) Head ¶
func (*GDrive) Put ¶
type LocalStorage ¶
type LocalStorage struct {
Storage
// contains filtered or unexported fields
}
func NewLocalStorage ¶
func NewLocalStorage(basedir string, logger *log.Logger) (*LocalStorage, error)
func (*LocalStorage) Delete ¶
func (s *LocalStorage) Delete(token string, filename string) (err error)
func (*LocalStorage) Get ¶
func (s *LocalStorage) Get(token string, filename string) (reader io.ReadCloser, contentType string, contentLength uint64, err error)
func (*LocalStorage) Head ¶
func (*LocalStorage) IsNotExist ¶
func (s *LocalStorage) IsNotExist(err error) bool
func (*LocalStorage) Put ¶
func (*LocalStorage) Type ¶
func (s *LocalStorage) Type() string
type Metadata ¶
type Metadata struct {
// ContentType is the original uploading content type
ContentType string
// Secret as knowledge to delete file
// Secret string
// Downloads is the actual number of downloads
Downloads int
// MaxDownloads contains the maximum numbers of downloads
MaxDownloads int
// MaxDate contains the max age of the file
MaxDate time.Time
// DeletionToken contains the token to match against for deletion
DeletionToken string
}
type S3Storage ¶
type S3Storage struct {
Storage
// contains filtered or unexported fields
}
func NewS3Storage ¶
func (*S3Storage) Get ¶
func (*S3Storage) Head ¶
func (*S3Storage) Put ¶
type Server ¶
type Server struct {
AuthUser string
AuthPass string
VirusTotalKey string
ClamAVDaemonHost string
TLSListenerOnly bool
ListenerString string
TLSListenerString string
ProfileListenerString string
Certificate string
LetsEncryptCache string
// contains filtered or unexported fields
}
func (*Server) BasicAuthHandler ¶
func (s *Server) BasicAuthHandler(h http.Handler) http.HandlerFunc
func (*Server) CheckDeletionToken ¶
type Storage ¶
type Storage interface {
Get(token string, filename string) (reader io.ReadCloser, contentType string, contentLength uint64, err error)
Head(token string, filename string) (contentType string, contentLength uint64, err error)
Put(token string, filename string, reader io.Reader, contentType string, contentLength uint64) error
Delete(token string, filename string) error
IsNotExist(err error) bool
Type() string
}
Source Files
¶
- clamav.go
- codec.go
- handlers.go
- server.go
- storage.go
- utils.go
- virustotal.go
Click to show internal directories.
Click to hide internal directories.