Documentation
¶
Index ¶
- type AutonomousSystem
- type Ban
- type Bin
- type Client
- type ClientByCountry
- type ClientByNetwork
- type ClientUploadFailure
- type ClientUploadSuccess
- type Common
- type Config
- type File
- type FileByChecksum
- type FileContent
- type Message
- type Metrics
- func (m *Metrics) DecrArchiveDownloadInProgress()
- func (m *Metrics) DecrFileUploadInProgress()
- func (m *Metrics) DecrStorageUploadInProgress()
- func (m *Metrics) IncrArchiveDownloadInProgress()
- func (m *Metrics) IncrBinBanCount()
- func (m *Metrics) IncrBinDeleteCount()
- func (m *Metrics) IncrBinLockCount()
- func (m *Metrics) IncrBinPageViewCount()
- func (m *Metrics) IncrBytesClientToFilebin(value uint64)
- func (m *Metrics) IncrBytesFilebinToClient(value uint64)
- func (m *Metrics) IncrBytesFilebinToStorage(value uint64)
- func (m *Metrics) IncrBytesStorageToClient(value uint64)
- func (m *Metrics) IncrBytesStorageToFilebin(value uint64)
- func (m *Metrics) IncrDBQueryError(operation string)
- func (m *Metrics) IncrErrorPageViewCount()
- func (m *Metrics) IncrFileDeleteCount()
- func (m *Metrics) IncrFileDownloadCount()
- func (m *Metrics) IncrFileUploadCount()
- func (m *Metrics) IncrFileUploadInProgress()
- func (m *Metrics) IncrFrontPageViewCount()
- func (m *Metrics) IncrNewBinCount()
- func (m *Metrics) IncrS3OperationError(operation string)
- func (m *Metrics) IncrStorageUploadInProgress()
- func (m *Metrics) IncrTarArchiveDownloadCount()
- func (m *Metrics) IncrZipArchiveDownloadCount()
- func (m *Metrics) ObserveClientUploadFailure(reason string, durationMs uint64, timeToFirstProgressMs uint64)
- func (m *Metrics) ObserveClientUploadSuccess(durationMs, uploadingMs, processingMs, timeToFirstProgressMs, ... uint64)
- func (m *Metrics) ObserveDBQuery(operation string, duration time.Duration)
- func (m *Metrics) ObserveHTTPRequest(method, handler string, duration time.Duration, statusCode int)
- func (m *Metrics) ObserveS3Operation(operation string, duration time.Duration)
- func (m *Metrics) UpdateDBStats(stats sql.DBStats)
- func (m *Metrics) UpdateGauges()
- type SiteMessage
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutonomousSystem ¶
type AutonomousSystem struct {
ASN int `json:"asn"`
Organization string `json:"organization"`
Network string `json:"network"`
Requests uint64 `json:"requests"`
ClientCount uint64 `json:"client_count"`
FilesUploaded uint64 `json:"files_uploaded"`
BytesUploaded uint64 `json:"bytes_uploaded"`
BytesUploadedReadable string `json:"bytes_uploaded_readable"`
FirstActiveAt time.Time `json:"first_active_at"`
FirstActiveAtRelative string `json:"first_active_at_relative"`
LastActiveAt time.Time `json:"last_active_at"`
LastActiveAtRelative string `json:"last_active_at_relative"`
BannedAt sql.NullTime `json:"banned_at"`
BannedAtRelative string `json:"banned_at_relative"`
}
func (*AutonomousSystem) IsBanned ¶
func (a *AutonomousSystem) IsBanned() bool
type Bin ¶
type Bin struct {
Id string `json:"id"`
Readonly bool `json:"readonly"`
Downloads uint64 `json:"-"`
FileDownloads uint64 `json:"-"`
Updates uint64 `json:"-"`
Bytes uint64 `json:"bytes"`
BytesReadable string `json:"bytes_readable"`
Files uint64 `json:"files"`
UpdatedAt time.Time `json:"updated_at"`
UpdatedAtRelative string `json:"updated_at_relative"`
CreatedAt time.Time `json:"created_at"`
CreatedAtRelative string `json:"created_at_relative"`
ApprovedAt sql.NullTime `json:"-"`
ApprovedAtRelative string `json:"-"`
ExpiredAt time.Time `json:"expired_at"`
ExpiredAtRelative string `json:"expired_at_relative"`
DeletedAt sql.NullTime `json:"-"`
DeletedAtRelative string `json:"-"`
URL string `json:"-"`
}
func (*Bin) GenerateURL ¶
func (*Bin) IsApproved ¶
func (*Bin) IsReadable ¶
func (*Bin) IsWritable ¶
type Client ¶
type Client struct {
IP string `json:"ip"`
ASN int `json:"asn"`
ASNOrganization string `json:"asn_organization"`
Network string `json:"network"`
City string `json:"city"`
Country string `json:"country"`
Continent string `json:"continent"`
Proxy bool `json:"proxy"`
Requests uint64 `json:"requests"`
FilesUploaded uint64 `json:"files_uploaded"`
BytesUploaded uint64 `json:"bytes_uploaded"`
BytesUploadedReadable string `json:"bytes_uploaded_readable"`
FirstActiveAt time.Time `json:"first_active_at"`
FirstActiveAtRelative string `json:"first_active_at_relative"`
LastActiveAt time.Time `json:"last_active_at"`
LastActiveAtRelative string `json:"last_active_at_relative"`
BannedAt sql.NullTime `json:"banned_at"`
BannedAtRelative string `json:"banned_at_relative"`
BannedBy string `json:"banned_by"`
}
type ClientByCountry ¶
type ClientByCountry struct {
Country string `json:"country"`
ClientCount uint64 `json:"client_count"`
Requests uint64 `json:"requests"`
FilesUploaded uint64 `json:"files_uploaded"`
BytesUploaded uint64 `json:"bytes_uploaded"`
BytesUploadedReadable string `json:"bytes_uploaded_readable"`
FirstActiveAt time.Time `json:"first_active_at"`
FirstActiveAtRelative string `json:"first_active_at_relative"`
LastActiveAt time.Time `json:"last_active_at"`
LastActiveAtRelative string `json:"last_active_at_relative"`
}
type ClientByNetwork ¶
type ClientByNetwork struct {
Network string `json:"network"`
ClientCount uint64 `json:"client_count"`
Requests uint64 `json:"requests"`
FilesUploaded uint64 `json:"files_uploaded"`
BytesUploaded uint64 `json:"bytes_uploaded"`
BytesUploadedReadable string `json:"bytes_uploaded_readable"`
FirstActiveAt time.Time `json:"first_active_at"`
FirstActiveAtRelative string `json:"first_active_at_relative"`
LastActiveAt time.Time `json:"last_active_at"`
LastActiveAtRelative string `json:"last_active_at_relative"`
}
type ClientUploadFailure ¶ added in v1.0.2
type ClientUploadFailure struct {
Timestamp time.Time `json:"timestamp"`
IP string `json:"ip"`
UserAgent string `json:"user_agent"`
Bin string `json:"bin"`
Filename string `json:"filename"`
UploadHost string `json:"upload_host"`
UploadProtocol string `json:"upload_protocol"`
ScriptHost string `json:"script_host"`
ScriptProtocol string `json:"script_protocol"`
TopFrame bool `json:"top_frame"`
Reason string `json:"reason"`
HTTPStatus int `json:"http_status"`
FileSize uint64 `json:"file_size"`
BytesUploaded uint64 `json:"bytes_uploaded"`
DurationMs uint64 `json:"duration_ms"`
TimeSinceLastProgressMs uint64 `json:"time_since_last_progress_ms"`
RetryAttempts int `json:"retry_attempts"`
ConnectionType string `json:"connection_type"`
ResponseBody string `json:"response_body"`
StatusText string `json:"status_text"`
ReadyState int `json:"ready_state"`
Stage string `json:"stage"`
Online bool `json:"online"`
Visibility string `json:"visibility"`
TimeToFirstProgressMs uint64 `json:"time_to_first_progress_ms"`
LastBytesPerSecond uint64 `json:"last_bytes_per_second"`
ConcurrentUploads int `json:"concurrent_uploads"`
Downlink float64 `json:"downlink"`
RTT int `json:"rtt"`
SaveData bool `json:"save_data"`
ResponseContentType string `json:"response_content_type"`
RequestID string `json:"request_id"`
}
ClientUploadFailure is a per-upload terminal failure reported by the browser. Retry attempts are not stored as separate events; the count is carried via RetryAttempts on the terminal record.
type ClientUploadSuccess ¶ added in v1.0.2
type ClientUploadSuccess struct {
Timestamp time.Time `json:"timestamp"`
IP string `json:"ip"`
UserAgent string `json:"user_agent"`
Bin string `json:"bin"`
Filename string `json:"filename"`
UploadHost string `json:"upload_host"`
UploadProtocol string `json:"upload_protocol"`
ScriptHost string `json:"script_host"`
ScriptProtocol string `json:"script_protocol"`
TopFrame bool `json:"top_frame"`
FileSize uint64 `json:"file_size"`
DurationMs uint64 `json:"duration_ms"`
UploadingMs uint64 `json:"uploading_ms"`
ProcessingMs uint64 `json:"processing_ms"`
TimeToFirstProgressMs uint64 `json:"time_to_first_progress_ms"`
AverageBytesPerSecond uint64 `json:"average_bytes_per_second"`
RetryAttempts int `json:"retry_attempts"`
ConnectionType string `json:"connection_type"`
Downlink float64 `json:"downlink"`
RTT int `json:"rtt"`
SaveData bool `json:"save_data"`
Visibility string `json:"visibility"`
}
ClientUploadSuccess is a per-upload completion event reported by the browser. The shape is intentionally slimmer than ClientUploadFailure: success events are high-volume, and the most useful client-side signal is the performance picture (throughput, time spent in each phase, retry count needed to finally succeed).
type Config ¶
type Config struct {
Version string
Contact string
CookieLifetime int
Expiration int
ExpirationDuration time.Duration
LimitFileDownloads uint64
LimitStorageReadable string
LimitStorageBytes uint64
ClientUploadFailuresCap int
ClientUploadSuccessesCap int
HttpPort int
HttpHost string
HttpProxyHeaders bool
HttpAccessLog string
AdminUsername string
AdminPassword string
MetricsUsername string
MetricsPassword string
Metrics bool
MetricsAuth string
MetricsProxyURL string
SlackSecret string
SlackDomain string
SlackChannel string
Tmpdir string
RequireApproval bool
RequireCookie bool
ExpectedCookieValue string
AllowRobots bool
BaseUrl url.URL
RejectFileExtensions []string
PostUploadHook string
PostUploadHookTimeout time.Duration
// Timeouts for the HTTP server
ReadTimeout time.Duration
ReadHeaderTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
}
type File ¶
type File struct {
Id int `json:"-"`
Bin string `json:"-"`
Filename string `json:"filename"`
Mime string `json:"content-type"`
Category string `json:"-"`
Bytes uint64 `json:"bytes"`
BytesReadable string `json:"bytes_readable"`
MD5 string `json:"md5"`
SHA256 string `json:"sha256"`
Downloads uint64 `json:"-"`
Updates uint64 `json:"-"`
InStorage bool `json:"-"`
IP string `json:"-"`
Headers string `json:"-"`
UpdatedAt time.Time `json:"updated_at"`
UpdatedAtRelative string `json:"updated_at_relative"`
CreatedAt time.Time `json:"created_at"`
CreatedAtRelative string `json:"created_at_relative"`
DeletedAt sql.NullTime `json:"-"`
DeletedAtRelative string `json:"-"`
BinDeletedAt sql.NullTime `json:"-"`
BinDeletedAtRelative string `json:"-"`
BinExpiredAt time.Time `json:"-"`
BinExpiredAtRelative string `json:"-"`
AvailableForDownload bool `json:"-"`
URL string `json:"-"`
UploadDurationMs int64 `json:"-"`
UploadDuration time.Duration `json:"-"`
UploadDurationReadable string `json:"-"`
}
func (*File) IsReadable ¶
type FileByChecksum ¶
type FileByChecksum struct {
SHA256 string `json:"sha256"`
Count int `json:"count"`
Mime string `json:"content-type"`
Bytes uint64 `json:"bytes"`
BytesReadable string `json:"bytes_readable"`
BytesTotal uint64 `json:"bytes_total"`
BytesTotalReadable string `json:"bytes_total_readable"`
DownloadsTotal uint64 `json:"downloads_total"`
UpdatesTotal uint64 `json:"updates_total"`
Blocked bool `json:"blocked"`
CreatedAt time.Time `json:"created_at"`
CreatedAtRelative string `json:"created_at_relative"`
LastReferencedAt time.Time `json:"last_referenced_at"`
LastReferencedAtRelative string `json:"last_referenced_at_relative"`
}
type FileContent ¶
type FileContent struct {
SHA256 string `json:"sha256"`
Bytes uint64 `json:"bytes"`
BytesReadable string `json:"bytes_readable"`
MD5 string `json:"md5"`
Mime string `json:"mime"`
PHash string `json:"phash,omitempty"`
InStorage bool `json:"in_storage"`
Blocked bool `json:"blocked"`
CreatedAt time.Time `json:"created_at"`
CreatedAtRelative string `json:"created_at_relative"`
LastReferencedAt time.Time `json:"last_referenced_at"`
LastReferencedAtRelative string `json:"last_referenced_at_relative"`
}
type Metrics ¶
type Metrics struct {
Id string `json:"-"`
// Database-sourced metrics (populated by UpdateMetrics)
CurrentLogEntries int64 `json:"current_log_entries"`
LimitBytes uint64 `json:"limit_bytes"`
CurrentBytes int64 `json:"current_bytes"`
CurrentBytesReadable string `json:"current_bytes_readable"`
CurrentFiles int64 `json:"current_files"`
CurrentFilesReadable string `json:"current_files_readable"`
CurrentBins int64 `json:"current_bins"`
CurrentBinsReadable string `json:"current_bins_readable"`
FreeBytes int64 `json:"-"`
FreeBytesReadable string `json:"-"`
TotalBytes int64 `json:"total_bytes"`
TotalBytesReadable string `json:"total_bytes_readable"`
TotalFiles int64 `json:"total_files"`
TotalFilesReadable string `json:"total_files_readable"`
TotalBins int64 `json:"total_bins"`
TotalBinsReadable string `json:"total_bins_readable"`
// S3 metrics
S3OperationDuration *prometheus.HistogramVec
S3OperationErrors *prometheus.CounterVec
// Database query metrics
DBQueryDuration *prometheus.HistogramVec
DBQueryErrors *prometheus.CounterVec
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(id string, registry *prometheus.Registry) *Metrics
func (*Metrics) DecrArchiveDownloadInProgress ¶
func (m *Metrics) DecrArchiveDownloadInProgress()
func (*Metrics) DecrFileUploadInProgress ¶
func (m *Metrics) DecrFileUploadInProgress()
func (*Metrics) DecrStorageUploadInProgress ¶
func (m *Metrics) DecrStorageUploadInProgress()
func (*Metrics) IncrArchiveDownloadInProgress ¶
func (m *Metrics) IncrArchiveDownloadInProgress()
func (*Metrics) IncrBinBanCount ¶
func (m *Metrics) IncrBinBanCount()
func (*Metrics) IncrBinDeleteCount ¶
func (m *Metrics) IncrBinDeleteCount()
func (*Metrics) IncrBinLockCount ¶
func (m *Metrics) IncrBinLockCount()
func (*Metrics) IncrBinPageViewCount ¶
func (m *Metrics) IncrBinPageViewCount()
func (*Metrics) IncrBytesClientToFilebin ¶
func (*Metrics) IncrBytesFilebinToClient ¶
Data transfer methods
func (*Metrics) IncrBytesFilebinToStorage ¶
func (*Metrics) IncrBytesStorageToClient ¶
func (*Metrics) IncrBytesStorageToFilebin ¶
func (*Metrics) IncrDBQueryError ¶ added in v0.0.3
func (*Metrics) IncrErrorPageViewCount ¶
func (m *Metrics) IncrErrorPageViewCount()
func (*Metrics) IncrFileDeleteCount ¶
func (m *Metrics) IncrFileDeleteCount()
func (*Metrics) IncrFileDownloadCount ¶
func (m *Metrics) IncrFileDownloadCount()
func (*Metrics) IncrFileUploadCount ¶
func (m *Metrics) IncrFileUploadCount()
File operation methods
func (*Metrics) IncrFileUploadInProgress ¶
func (m *Metrics) IncrFileUploadInProgress()
In-progress operation methods
func (*Metrics) IncrFrontPageViewCount ¶
func (m *Metrics) IncrFrontPageViewCount()
Page view methods
func (*Metrics) IncrS3OperationError ¶ added in v0.0.3
func (*Metrics) IncrStorageUploadInProgress ¶
func (m *Metrics) IncrStorageUploadInProgress()
func (*Metrics) IncrTarArchiveDownloadCount ¶
func (m *Metrics) IncrTarArchiveDownloadCount()
Archive download methods
func (*Metrics) IncrZipArchiveDownloadCount ¶
func (m *Metrics) IncrZipArchiveDownloadCount()
func (*Metrics) ObserveClientUploadFailure ¶ added in v1.0.2
func (m *Metrics) ObserveClientUploadFailure(reason string, durationMs uint64, timeToFirstProgressMs uint64)
ObserveClientUploadFailure records a terminal failure event with all associated histograms. reason is the bucketed failure reason (network|stalled|http_5xx|http_4xx|http_other).
func (*Metrics) ObserveClientUploadSuccess ¶ added in v1.0.2
func (m *Metrics) ObserveClientUploadSuccess(durationMs, uploadingMs, processingMs, timeToFirstProgressMs, avgBytesPerSecond uint64)
ObserveClientUploadSuccess records a successful upload with throughput and timing histograms.
func (*Metrics) ObserveDBQuery ¶ added in v0.0.3
Database query metrics methods
func (*Metrics) ObserveHTTPRequest ¶ added in v0.0.3
func (m *Metrics) ObserveHTTPRequest(method, handler string, duration time.Duration, statusCode int)
HTTP metrics methods
func (*Metrics) ObserveS3Operation ¶ added in v0.0.3
S3 metrics methods
func (*Metrics) UpdateDBStats ¶ added in v0.0.3
Database connection pool metrics
type SiteMessage ¶
type SiteMessage struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Color string `json:"color"`
PublishedFrontPage bool `json:"published_front_page"`
PublishedBinPage bool `json:"published_bin_page"`
CreatedAt time.Time `json:"created_at"`
CreatedAtRelative string `json:"created_at_relative"`
UpdatedAt time.Time `json:"updated_at"`
UpdatedAtRelative string `json:"updated_at_relative"`
}
func (SiteMessage) GetAlertClass ¶
func (m SiteMessage) GetAlertClass() string
func (SiteMessage) HasContent ¶
func (m SiteMessage) HasContent() bool
func (SiteMessage) IsEmpty ¶
func (m SiteMessage) IsEmpty() bool
func (SiteMessage) IsPublishedBinPage ¶
func (m SiteMessage) IsPublishedBinPage() bool
func (SiteMessage) IsPublishedFrontPage ¶
func (m SiteMessage) IsPublishedFrontPage() bool
type Transaction ¶
type Transaction struct {
Id int `json:"-"`
BinId string `json:"bin"`
Filename string `json:"filename"`
Method string `json:"method"`
Path string `json:"path"`
IP string `json:"ip"`
Status int `json:"status"`
ReqBytes int64 `json:"req_bytes"`
ReqBytesReadable string `json:"request-bytes-readable"`
RespBytes int64 `json:"resp_bytes"`
RespBytesReadable string `json:"response-bytes-readable"`
Operation string `json:"-"`
Headers string `json:"trace"`
Timestamp time.Time `json:"timestamp"`
TimestampRelative string `json:"timestamp_relative"`
CompletedAt time.Time `json:"completed"`
Duration time.Duration `json:"duration"`
}