hostname

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hostname 规范化与校验按 Host 头或 TLS SNI 匹配的域名。

浏览器发出的 Host 与 SNI 总是小写、不带方括号的 IPv6、国际化域名为 punycode, 这里把配置中的写法统一成同样的形式,保存时就能发现永远匹配不上的写法(带端口、路径、@ 等)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(d string, wildcard bool) (string, bool)

Normalize 规范化一条域名:去掉空白与首尾的点,转为小写;IPv6 去掉方括号并转为标准写法; 国际化域名转为 punycode。wildcard 为 true 时允许单独的 * 与 *.example.com。 空字符串原样返回 ok;不是合法主机名、IP 或通配写法时 ok 为 false。

Types

This section is empty.

Jump to

Keyboard shortcuts

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