httpping

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const PingProtocolID = "/http-ping/1"

PingProtocolID 定义了HTTP ping协议的标识符

Variables

This section is empty.

Functions

func SendPing

func SendPing(client http.Client) error

SendPing 通过HTTP发送ping请求 参数:

  • client: HTTP客户端,应该针对Ping协议进行配置

返回值:

  • error: 如果发生错误则返回错误信息

Types

type Ping

type Ping struct{}

Ping 结构体实现了HTTP ping服务

func (Ping) ServeHTTP

func (Ping) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP 实现了http.Handler接口 参数:

  • w: HTTP响应写入器
  • r: HTTP请求对象

Jump to

Keyboard shortcuts

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