Documentation
¶
Overview ¶
Package utils provides shared utility functions.
Index ¶
- Constants
- func BytesToString(b []byte) string
- func CheckSingleton() error
- func DecodeJSON(r io.Reader, v any) error
- func DefaultRestyClient() *resty.Client
- func DownloadFile(url, filename string) error
- func EmbedServer() error
- func EncodeJSON(w io.Writer, v any) error
- func EncodeJSONEscapeHTML(w io.Writer, v any, esc bool) error
- func EncodeJSONEscapeHTMLIndent(w io.Writer, v any, esc bool, indent string) error
- func FileExist(name string) bool
- func GetFunctionName(i any) string
- func GetRemoteAddr(req *http.Request) string
- func HTTPTransport() *http.Transport
- func HasHan(txt string) bool
- func HostInfo() (string, string, error)
- func IsRoutableIP(ipStr string) bool
- func IsUnixAddr(addr string) bool
- func IsUrl(text string) bool
- func NetListener(addr string) (net.Listener, error)
- func NewUUID() string
- func ParseFunctionName(name string) (string, string)
- func PortAvailable(port string) bool
- func RandomString(n int) (string, error)
- func RestyClientWithTrace() *resty.Client
- func SHA256(txt string) string
- func SameStringSlice(x, y []string) bool
- func SignalHandler() <-chan bool
- func StringToBytes(s string) []byte
- func ToAbsolutePath(base, path string) string
- func ValidImageContentType(ct string) bool
Constants ¶
const EmbedServerPort = "15656"
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
BytesToString converts byte slice to string without allocation.
func CheckSingleton ¶ added in v0.13.1
func CheckSingleton() error
func DefaultRestyClient ¶ added in v0.35.2
func DownloadFile ¶ added in v0.32.1
func EmbedServer ¶ added in v0.13.1
func EmbedServer() error
func EncodeJSONEscapeHTML ¶ added in v0.35.2
func EncodeJSONEscapeHTMLIndent ¶ added in v0.35.2
func GetFunctionName ¶
func GetRemoteAddr ¶
GetRemoteAddr Obtain IP address of the client.
func HTTPTransport ¶ added in v0.92.0
HTTPTransport returns the shared HTTP transport with connection pool tuning. Provider implementations that create raw http.Client instances should use this instead of http.DefaultTransport to ensure consistent pool behavior across all outgoing provider calls.
func IsRoutableIP ¶
func IsUnixAddr ¶
IsUnixAddr Check if specified address is a unix socket like "unix:/run/flowbot.sock".
func NetListener ¶
NetListener creates net.Listener for tcp and unix domains: if addr is in the form "unix:/run/flowbot.sock" it's a unix socket, otherwise TCP host:port.
func ParseFunctionName ¶
func PortAvailable ¶ added in v0.13.1
func RandomString ¶ added in v0.32.1
func RestyClientWithTrace ¶ added in v0.92.0
RestyClientWithTrace returns a resty client configured with OTel HTTP tracing. The underlying http.Transport is wrapped with otelhttp.NewTransport which automatically propagates W3C TraceContext headers and creates client spans for outgoing requests.
Providers should use SetContext(ctx) on individual requests to ensure the span context is propagated from the caller's context.
func SameStringSlice ¶
func SignalHandler ¶ added in v0.18.1
func SignalHandler() <-chan bool
func StringToBytes ¶
StringToBytes converts string to byte slice without allocation.
func ToAbsolutePath ¶
ToAbsolutePath Convert relative filepath to absolute.
func ValidImageContentType ¶
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package reexec facilitates the busybox style reexec of the docker binary that we require because of the forking limitations of using Go.
|
Package reexec facilitates the busybox style reexec of the docker binary that we require because of the forking limitations of using Go. |
|
Package sets provides generic set data structures.
|
Package sets provides generic set data structures. |
|
Package syncx provides synchronized concurrent-safe data structures.
|
Package syncx provides synchronized concurrent-safe data structures. |