MCPcopy
hub / github.com/caddyserver/caddy / TestServerNameMatcher

Function TestServerNameMatcher

modules/caddytls/matchers_test.go:26–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestServerNameMatcher(t *testing.T) {
27 for i, tc := range []struct {
28 names []string
29 input string
30 expect bool
31 }{
32 {
33 names: []string{"example.com"},
34 input: "example.com",
35 expect: true,
36 },
37 {
38 names: []string{"example.com"},
39 input: "foo.com",
40 expect: false,
41 },
42 {
43 names: []string{"example.com"},
44 input: "",
45 expect: false,
46 },
47 {
48 names: []string{},
49 input: "",
50 expect: false,
51 },
52 {
53 names: []string{"foo", "example.com"},
54 input: "example.com",
55 expect: true,
56 },
57 {
58 names: []string{"foo", "example.com"},
59 input: "sub.example.com",
60 expect: false,
61 },
62 {
63 names: []string{"foo", "example.com"},
64 input: "foo.com",
65 expect: false,
66 },
67 {
68 names: []string{"*.example.com"},
69 input: "example.com",
70 expect: false,
71 },
72 {
73 names: []string{"*.example.com"},
74 input: "sub.example.com",
75 expect: true,
76 },
77 {
78 names: []string{"*.example.com", "*.sub.example.com"},
79 input: "sub2.sub.example.com",
80 expect: true,
81 },
82 {
83 names: []string{"つ.localhost"},

Callers

nothing calls this directly

Calls 2

MatchServerNameTypeAlias · 0.85
MatchMethod · 0.65

Tested by

no test coverage detected