MCPcopy
hub / github.com/caddyserver/certmagic / TestGetACMEChallenge_IPv6Brackets

Function TestGetACMEChallenge_IPv6Brackets

solvers_test.go:222–242  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

220}
221
222func TestGetACMEChallenge_IPv6Brackets(t *testing.T) {
223 // Store a challenge under a bare IPv6 identifier (as CertMagic does internally).
224 bare := "::1"
225 activeChallengesMu.Lock()
226 activeChallenges[bare] = Challenge{}
227 activeChallengesMu.Unlock()
228 defer func() {
229 activeChallengesMu.Lock()
230 delete(activeChallenges, bare)
231 activeChallengesMu.Unlock()
232 }()
233
234 // Lookup with bracketed IPv6 (as received from Go's HTTP server via r.Host).
235 if _, ok := GetACMEChallenge("[::1]"); !ok {
236 t.Error("GetACMEChallenge(\"[::1]\") should find challenge stored under \"::1\"")
237 }
238 // Lookup with bare IPv6 should still work.
239 if _, ok := GetACMEChallenge("::1"); !ok {
240 t.Error("GetACMEChallenge(\"::1\") should find challenge stored under \"::1\"")
241 }
242}
243
244func TestTryListen(t *testing.T) {
245 // Make sure that a regular TCP address still works.

Callers

nothing calls this directly

Calls 4

GetACMEChallengeFunction · 0.85
ErrorMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…