Documentation
¶
Index ¶
- func DenyNonPublicAddress(_, address string, _ syscall.RawConn) error
- func GetAbsolutePath(path string) (string, error)
- func GetDefaultConfigPath() (string, error)
- func IsLoopbackHost(host string) bool
- func IsSymlinkToDir(path string) bool
- func NewPublicHTTPClient(timeout time.Duration, ...) *http.Client
- func ReturnItem(item string) string
- type GroupItems
- type GroupsItemsSelector
- func (o *GroupsItemsSelector[I]) AddGroupItems(group string, items ...I)
- func (o *GroupsItemsSelector[I]) FindGroupsByItem(item I) (groups []string)
- func (o *GroupsItemsSelector[I]) FindGroupsByItemFirst(item I) (ret string)
- func (o *GroupsItemsSelector[I]) GetGroupAndItemByItemNumber(number int) (group string, item I, err error)
- func (o *GroupsItemsSelector[I]) HasGroup(group string) (ret bool)
- func (o *GroupsItemsSelector[I]) Print(shellCompleteList bool)
- type GroupsItemsSelectorString
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DenyNonPublicAddress ¶ added in v1.4.516
DenyNonPublicAddress is a Control function for net.Dialer. The dialer calls it after DNS resolution, with the IP address and the port of the connection. It returns an error if the address is not a public IP address: loopback, private, unique local, link-local, multicast, unspecified, or in nonPublicPrefixes.
func GetAbsolutePath ¶
GetAbsolutePath resolves a given path to its absolute form, handling ~, ./, ../, UNC paths, and symlinks.
func GetDefaultConfigPath ¶ added in v1.4.256
GetDefaultConfigPath returns the default path for the configuration file if it exists, otherwise returns an empty string.
func IsLoopbackHost ¶ added in v1.4.536
IsLoopbackHost tells if host is "localhost", a subdomain of "localhost" or a loopback IP address. The host has no port and no IPv6 brackets.
func IsSymlinkToDir ¶
Helper function to check if a symlink points to a directory
func NewPublicHTTPClient ¶ added in v1.4.516
func NewPublicHTTPClient(timeout time.Duration, control func(network, address string, c syscall.RawConn) error) *http.Client
NewPublicHTTPClient returns an HTTP client for a URL that a template or a request supplies. control is the Control function of the dialer. If control is nil, the client uses DenyNonPublicAddress. The dialer calls control for each connection, thus also for each redirect. A test gives a different function to connect to an httptest server on a loopback address. When DenyNonPublicAddress refuses an address, the error of the client does not include the IP address.
The client stops a request after timeout. It follows a maximum of maxRedirects redirects, and it refuses a redirect to a scheme that is not http or https. The transport refuses these schemes on the first request. The client does not use a proxy, because control must see the address of the server. Each request uses a new connection, thus a client for one request keeps no idle connection.
func ReturnItem ¶
Types ¶
type GroupItems ¶
func (*GroupItems[I]) ContainsItemBy ¶
func (o *GroupItems[I]) ContainsItemBy(predicate func(item I) bool) (ret bool)
func (*GroupItems[I]) Count ¶
func (o *GroupItems[I]) Count() int
type GroupsItemsSelector ¶
type GroupsItemsSelector[I any] struct { SelectionLabel string GetItemKey func(I) string GroupsItems []*GroupItems[I] }
func NewGroupsItemsSelector ¶
func NewGroupsItemsSelector[I any](selectionLabel string, getItemLabel func(I) string) *GroupsItemsSelector[I]
func (*GroupsItemsSelector[I]) AddGroupItems ¶
func (o *GroupsItemsSelector[I]) AddGroupItems(group string, items ...I)
func (*GroupsItemsSelector[I]) FindGroupsByItem ¶
func (o *GroupsItemsSelector[I]) FindGroupsByItem(item I) (groups []string)
func (*GroupsItemsSelector[I]) FindGroupsByItemFirst ¶
func (o *GroupsItemsSelector[I]) FindGroupsByItemFirst(item I) (ret string)
func (*GroupsItemsSelector[I]) GetGroupAndItemByItemNumber ¶
func (o *GroupsItemsSelector[I]) GetGroupAndItemByItemNumber(number int) (group string, item I, err error)
func (*GroupsItemsSelector[I]) HasGroup ¶
func (o *GroupsItemsSelector[I]) HasGroup(group string) (ret bool)
func (*GroupsItemsSelector[I]) Print ¶
func (o *GroupsItemsSelector[I]) Print(shellCompleteList bool)
type GroupsItemsSelectorString ¶
type GroupsItemsSelectorString struct {
*GroupsItemsSelector[string]
}
func NewGroupsItemsSelectorString ¶
func NewGroupsItemsSelectorString(selectionLabel string) *GroupsItemsSelectorString