Documentation
¶
Index ¶
- Constants
- Variables
- func CleanupLogs(retentionCount int)
- func ConfigureDebug(dir string)
- func ConfigureDialer(dialer *net.Dialer, customAddr string)
- func ConvertBytesToHumanReadable(bytes int64) string
- func CopyFile(src, dst string) error
- func CopyRedirectHeaders(dst, src *http.Request)
- func Debug(format string, args ...any)
- func DetermineFilename(rawurl string, resp *http.Response) (string, io.Reader, error)
- func EnsureAbsPath(path string) string
- func IsLoggingEnabled() bool
- func Notify(title, message string)
- func OpenBrowser(url string) error
- func OpenContainingFolder(path string) error
- func OpenFile(path string) error
- func ReadURLsFromFile(filepath string) ([]string, error)
Constants ¶
const NotificationAppName = "Surge"
Variables ¶
var SuppressNotifications bool
SuppressNotifications can be set to true to prevent desktop notifications. Tests should set this to true via TestMain or init() to avoid notification spam.
Functions ¶
func CleanupLogs ¶
func CleanupLogs(retentionCount int)
CleanupLogs removes old log files, keeping only the most recent retentionCount files
func ConfigureDebug ¶
func ConfigureDebug(dir string)
ConfigureDebug sets the directory for debug logs
func ConfigureDialer ¶ added in v0.8.0
ConfigureDialer modifies the provided net.Dialer to route all DNS lookups through the specified custom DNS server address. customAddr should include the port, e.g., "1.1.1.1:53".
func ConvertBytesToHumanReadable ¶
ConvertBytesToHumanReadable converts a given number of bytes into a human-readable format (e.g., KB, MB, GB).
func CopyRedirectHeaders ¶
CopyRedirectHeaders preserves all headers for same-origin redirects but strips sensitive headers (cookies, auth) for cross-domain redirects.
func DetermineFilename ¶
DetermineFilename extracts the filename from a URL and HTTP response, applying various heuristics. It returns the determined filename, a new io.Reader that includes any sniffed header bytes, and an error.
func EnsureAbsPath ¶
EnsureAbsPath takes a clean path and forces it to be absolute. If it fails to get absolute path (rare), it checks if it's already absolute, otherwise relies on the input.
func IsLoggingEnabled ¶ added in v0.7.7
func IsLoggingEnabled() bool
IsLoggingEnabled returns true if debug logging is configured This allows callers to skip expensive argument evaluation
func OpenBrowser ¶ added in v0.8.0
OpenBrowser opens a URL in the system's default web browser.
func OpenContainingFolder ¶
func ReadURLsFromFile ¶
ReadURLsFromFile reads URLs from a file. Accepts one URL per line or whitespace-separated URLs, and ignores comments. Trailing-slash-only variants are treated as the same URL so batch imports behave consistently across CLI and TUI entry points.
Types ¶
This section is empty.