Utility Go-API
utility
Section titled “utility”import "givc/modules/pkgs/utility"SPDX-FileCopyrightText: 2024-2026 TII (SSRC) and the Ghaf contributors SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2024-2026 TII (SSRC) and the Ghaf contributors SPDX-License-Identifier: Apache-2.0
- Variables
- func CertIPVerifyInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
- func CheckStringInArray(element string, array []string) bool
- func FindCGroupPath(serviceName string) (string, error)
- func GetCGroupPathForProcess(pid uint32) (string, error)
- func GetFqdn(addrs []net.IP) (string, error)
- func GetHostname() (string, error)
- func GetInterfaceIpv4(ifname string) (string, error)
- func GetInterfaceIpv4Dns(hostname string) (string, error)
- func GetIps(hostname string) ([]net.IP, error)
- func GetOutboundIP() net.IP
- func IsRoot() bool
- func IsUser(username string) bool
- func ParseVsockAddress(addr string) (uint32, uint32, error)
- func TlsClientConfig(cacertFilePath string, certFilePath string, keyFilePath string, serverName string) (*tls.Config, error)
- func TlsClientConfigFromTlsConfig(tlsConfig *tls.Config, serverName string) (*tls.Config, error)
- func TlsServerConfig(cacertFilePath string, certFilePath string, keyFilePath string, mutual bool) (*tls.Config, error)
- func extractIPFromAddr(addr net.Addr) (net.IP, error)
- func ipInCertSAN(cert *x509.Certificate, ip net.IP) bool
Variables
Section titled “Variables”var ( CIPHER_SUITES = []uint16{ tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, })func CertIPVerifyInterceptor
Section titled “func CertIPVerifyInterceptor”func CertIPVerifyInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)CertIPVerifyInterceptor is a gRPC server interceptor that verifies the peer’s IP address matches an IP in their TLS certificate’s SubjectAltName.
TCP: Verifies peer IP matches certificate SAN. Vsock/Unix: Skips IP check (hypervisor/filesystem provides isolation).
func CheckStringInArray
Section titled “func CheckStringInArray”func CheckStringInArray(element string, array []string) boolfunc FindCGroupPath
Section titled “func FindCGroupPath”func FindCGroupPath(serviceName string) (string, error)func GetCGroupPathForProcess
Section titled “func GetCGroupPathForProcess”func GetCGroupPathForProcess(pid uint32) (string, error)func GetFqdn
Section titled “func GetFqdn”func GetFqdn(addrs []net.IP) (string, error)func GetHostname
Section titled “func GetHostname”func GetHostname() (string, error)func GetInterfaceIpv4
Section titled “func GetInterfaceIpv4”func GetInterfaceIpv4(ifname string) (string, error)func GetInterfaceIpv4Dns
Section titled “func GetInterfaceIpv4Dns”func GetInterfaceIpv4Dns(hostname string) (string, error)func GetIps
Section titled “func GetIps”func GetIps(hostname string) ([]net.IP, error)func GetOutboundIP
Section titled “func GetOutboundIP”func GetOutboundIP() net.IPfunc IsRoot
Section titled “func IsRoot”func IsRoot() boolfunc IsUser
Section titled “func IsUser”func IsUser(username string) boolfunc ParseVsockAddress
Section titled “func ParseVsockAddress”func ParseVsockAddress(addr string) (uint32, uint32, error)func TlsClientConfig
Section titled “func TlsClientConfig”func TlsClientConfig(cacertFilePath string, certFilePath string, keyFilePath string, serverName string) (*tls.Config, error)func TlsClientConfigFromTlsConfig
Section titled “func TlsClientConfigFromTlsConfig”func TlsClientConfigFromTlsConfig(tlsConfig *tls.Config, serverName string) (*tls.Config, error)func TlsServerConfig
Section titled “func TlsServerConfig”func TlsServerConfig(cacertFilePath string, certFilePath string, keyFilePath string, mutual bool) (*tls.Config, error)func extractIPFromAddr
Section titled “func extractIPFromAddr”func extractIPFromAddr(addr net.Addr) (net.IP, error)extractIPFromAddr extracts the IP address from a net.Addr
func ipInCertSAN
Section titled “func ipInCertSAN”func ipInCertSAN(cert *x509.Certificate, ip net.IP) boolipInCertSAN checks if the given IP is in the certificate’s SubjectAltName IP addresses
Generated by gomarkdoc