Documentation
¶
Index ¶
- Constants
- Variables
- func DetectContentType(key string) string
- func DirExists(path string) bool
- func EnsureDir(path string) error
- func EnsureParent(path string) error
- func FileExists(path string) bool
- func GetFreePort() (int, error)
- func IsValidEmail(email string) bool
- func IsValidURL(urlString string) bool
- func IsWritable(path string) bool
- func Map[T, U any](seq iter.Seq[T], f func(T) U) iter.Seq[U]
- func MaskSecret(s string) string
- func ResolvePath(path string) (string, error)
- func TokenHex(len int) string
- func ValidateEmail(email string) error
- func ValidateURL(urlString string) error
- type LogInterceptor
- type MultiLogHandler
- type SyftBoxURL
- func (s *SyftBoxURL) BaseURL() string
- func (s *SyftBoxURL) MarshalJSON() ([]byte, error)
- func (s *SyftBoxURL) SetQueryParams(queryParams map[string]string)
- func (s *SyftBoxURL) String() string
- func (s *SyftBoxURL) ToLocalPath() string
- func (s *SyftBoxURL) UnmarshalJSON(data []byte) error
- func (s *SyftBoxURL) UnmarshalParam(param string) error
- func (s *SyftBoxURL) Validate() error
- type ValidationError
Constants ¶
const SyftBoxArt = `` /* 214-byte string literal not displayed */
Variables ¶
var (
ErrInvalidEmail = errors.New("invalid email")
)
var (
ErrInvalidURL = errors.New("invalid url")
)
var (
HWID, _ = machineid.ProtectedID("syftbox")
)
Functions ¶
func DetectContentType ¶ added in v0.8.0
func EnsureParent ¶
func FileExists ¶
func GetFreePort ¶
func IsValidEmail ¶
func IsValidURL ¶
func IsWritable ¶ added in v0.7.0
func MaskSecret ¶
func ResolvePath ¶
func ValidateEmail ¶
func ValidateURL ¶
Types ¶
type LogInterceptor ¶
type LogInterceptor struct {
// contains filtered or unexported fields
}
LogInterceptor implements io.Writer and intercepts output to add structured logging information. It adds a sequence number and timestamp to each line of output.
func NewLogInterceptor ¶
func NewLogInterceptor(target io.WriteCloser) *LogInterceptor
NewLogInterceptor creates a new LogInterceptor that adds structured logging information to each line. The interceptor will write to the provided target writer, adding a sequence number and timestamp to each line of output.
func (*LogInterceptor) Close ¶
func (i *LogInterceptor) Close() error
Close flushes any remaining buffered data to the target writer and closes it. If there's incomplete line data in the buffer, it will be written without a trailing newline. Returns any error encountered during the flush or close operation.
func (*LogInterceptor) Write ¶
func (i *LogInterceptor) Write(p []byte) (n int, err error)
Write implements io.Writer. It processes input data line by line, adding sequence numbers and timestamps to each complete line. Incomplete lines are buffered until a newline is received. Returns the number of bytes from p that were processed and any error encountered.
type MultiLogHandler ¶
type MultiLogHandler struct {
// contains filtered or unexported fields
}
MultiLogHandler implements slog.Handler interface and forwards logs to multiple handlers
func NewMultiLogHandler ¶
func NewMultiLogHandler(handlers ...slog.Handler) *MultiLogHandler
NewMultiLogHandler creates a new MultiLogHandler that forwards logs to multiple handlers
type SyftBoxURL ¶ added in v0.6.0
type SyftBoxURL struct {
Datasite string `json:"datasite"`
AppName string `json:"app_name"`
Endpoint string `json:"endpoint"`
QueryParams map[string]string `json:"query_params"`
}
SyftBoxURL represents a parsed syft:// URL with its components
func FromSyftURL ¶ added in v0.6.0
func FromSyftURL(rawURL string) (*SyftBoxURL, error)
FromSyftURL parses a syft URL string into a SyftBoxURL struct
func NewSyftBoxURL ¶ added in v0.6.0
func NewSyftBoxURL(datasite, appName, endpoint string) (*SyftBoxURL, error)
NewSyftBoxURL creates a new SyftBoxURL with validation
func (*SyftBoxURL) MarshalJSON ¶ added in v0.8.2
func (s *SyftBoxURL) MarshalJSON() ([]byte, error)
func (*SyftBoxURL) SetQueryParams ¶ added in v0.6.0
func (s *SyftBoxURL) SetQueryParams(queryParams map[string]string)
SetQueryParams sets the query parameters
func (*SyftBoxURL) String ¶ added in v0.6.0
func (s *SyftBoxURL) String() string
String returns the string representation of the SyftBoxURL
func (*SyftBoxURL) ToLocalPath ¶ added in v0.6.0
func (s *SyftBoxURL) ToLocalPath() string
ToLocalPath converts the SyftBoxURL to a local file system path
func (*SyftBoxURL) UnmarshalJSON ¶ added in v0.8.2
func (s *SyftBoxURL) UnmarshalJSON(data []byte) error
func (*SyftBoxURL) UnmarshalParam ¶ added in v0.6.0
func (s *SyftBoxURL) UnmarshalParam(param string) error
UnmarshalParam implements gin.UnmarshalParam for automatic query param binding
func (*SyftBoxURL) Validate ¶ added in v0.6.0
func (s *SyftBoxURL) Validate() error
Validate validates the SyftBoxURL fields
type ValidationError ¶ added in v0.6.0
ValidationError represents a validation error with field context
func (*ValidationError) Error ¶ added in v0.6.0
func (e *ValidationError) Error() string