hostname

package
v0.4.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMatch

func IsMatch(pattern, hostname string) bool

检查目标主机名是否匹配待匹配主机名。 兼容目标主机名开头是 "." 的情况(视为泛域名)。

入参:

  • pattern: 待匹配主机名,可以是泛域名。如 "*.example.com"。
  • hostname: 目标主机名。如 "sub.example.com"。

出参:

  • 是否匹配。

func IsMatchByCertificate added in v0.4.21

func IsMatchByCertificate(certX509 *x509.Certificate, hostname string) bool

检查目标主机名是否匹配证书。 兼容目标主机名开头是 "." 的情况(视为泛域名)。

入参:

  • certX509: 证书 X509 对象。
  • hostname: 目标主机名。如 "sub.example.com"。

出参:

  • 是否匹配。

func IsMatchByCertificatePEM added in v0.4.21

func IsMatchByCertificatePEM(certPEM string, hostname string) bool

检查目标主机名是否匹配证书。 兼容目标主机名开头是 "." 的情况(视为泛域名)。

入参:

  • certPEM: 证书 PEM 内容。
  • hostname: 目标主机名。如 "sub.example.com"。

出参:

  • 是否匹配。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL