format and add newline (#3969)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
This commit is contained in:
parent
f4a1a0fe8a
commit
8647592786
7 changed files with 37 additions and 30 deletions
|
@ -27,6 +27,7 @@ env:
|
||||||
- TEST_TYPE=integration
|
- TEST_TYPE=integration
|
||||||
- TEST_TYPE=core
|
- TEST_TYPE=core
|
||||||
- TEST_TYPE=plugin
|
- TEST_TYPE=plugin
|
||||||
|
- TEST_TYPE=fmt
|
||||||
# - TEST_TYPE=fuzzit FUZZIT_TYPE=local-regression
|
# - TEST_TYPE=fuzzit FUZZIT_TYPE=local-regression
|
||||||
# - TEST_TYPE=fuzzit FUZZIT_TYPE=fuzzing
|
# - TEST_TYPE=fuzzit FUZZIT_TYPE=fuzzing
|
||||||
|
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -28,6 +28,9 @@ endif
|
||||||
ifeq ($(TEST_TYPE),integration)
|
ifeq ($(TEST_TYPE),integration)
|
||||||
( cd test; go test -race ./... )
|
( cd test; go test -race ./... )
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(TEST_TYPE),fmt)
|
||||||
|
( echo "fmt"; gofmt -w -s . | grep ".*\.go"; if [ "$$?" = "0" ]; then exit 1; fi )
|
||||||
|
endif
|
||||||
ifeq ($(TEST_TYPE),plugin)
|
ifeq ($(TEST_TYPE),plugin)
|
||||||
( cd plugin; go test -race ./... )
|
( cd plugin; go test -race ./... )
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -164,7 +164,7 @@ func TestDNS64(t *testing.T) {
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
Opcode: dns.OpcodeQuery,
|
Opcode: dns.OpcodeQuery,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
},
|
},
|
||||||
initResp: &dns.Msg{ //success, no answers
|
initResp: &dns.Msg{ //success, no answers
|
||||||
MsgHdr: dns.MsgHdr{
|
MsgHdr: dns.MsgHdr{
|
||||||
|
@ -174,7 +174,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Ns: []dns.RR{test.SOA("example.com. 70 IN SOA foo bar 1 1 1 1 1")},
|
Ns: []dns.RR{test.SOA("example.com. 70 IN SOA foo bar 1 1 1 1 1")},
|
||||||
},
|
},
|
||||||
aResp: &dns.Msg{
|
aResp: &dns.Msg{
|
||||||
|
@ -185,7 +185,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeA, dns.ClassINET}},
|
||||||
Answer: []dns.RR{
|
Answer: []dns.RR{
|
||||||
test.A("example.com. 60 IN A 192.0.2.42"),
|
test.A("example.com. 60 IN A 192.0.2.42"),
|
||||||
test.A("example.com. 5000 IN A 192.0.2.43"),
|
test.A("example.com. 5000 IN A 192.0.2.43"),
|
||||||
|
@ -200,7 +200,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Answer: []dns.RR{
|
Answer: []dns.RR{
|
||||||
test.AAAA("example.com. 60 IN AAAA 64:ff9b::192.0.2.42"),
|
test.AAAA("example.com. 60 IN AAAA 64:ff9b::192.0.2.42"),
|
||||||
// override RR ttl to SOA ttl, since it's lower
|
// override RR ttl to SOA ttl, since it's lower
|
||||||
|
@ -217,7 +217,7 @@ func TestDNS64(t *testing.T) {
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
Opcode: dns.OpcodeQuery,
|
Opcode: dns.OpcodeQuery,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
},
|
},
|
||||||
initResp: &dns.Msg{ //success, no answers
|
initResp: &dns.Msg{ //success, no answers
|
||||||
MsgHdr: dns.MsgHdr{
|
MsgHdr: dns.MsgHdr{
|
||||||
|
@ -227,7 +227,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
||||||
},
|
},
|
||||||
aResp: &dns.Msg{
|
aResp: &dns.Msg{
|
||||||
|
@ -238,7 +238,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeA, dns.ClassINET}},
|
||||||
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
||||||
Answer: []dns.RR{}, // just to make comparison happy
|
Answer: []dns.RR{}, // just to make comparison happy
|
||||||
},
|
},
|
||||||
|
@ -264,7 +264,7 @@ func TestDNS64(t *testing.T) {
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
Opcode: dns.OpcodeQuery,
|
Opcode: dns.OpcodeQuery,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
},
|
},
|
||||||
initResp: &dns.Msg{ // failure
|
initResp: &dns.Msg{ // failure
|
||||||
MsgHdr: dns.MsgHdr{
|
MsgHdr: dns.MsgHdr{
|
||||||
|
@ -274,7 +274,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeRefused,
|
Rcode: dns.RcodeRefused,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
},
|
},
|
||||||
aResp: &dns.Msg{
|
aResp: &dns.Msg{
|
||||||
MsgHdr: dns.MsgHdr{
|
MsgHdr: dns.MsgHdr{
|
||||||
|
@ -284,7 +284,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeA, dns.ClassINET}},
|
||||||
Answer: []dns.RR{
|
Answer: []dns.RR{
|
||||||
test.A("example.com. 60 IN A 192.0.2.42"),
|
test.A("example.com. 60 IN A 192.0.2.42"),
|
||||||
test.A("example.com. 5000 IN A 192.0.2.43"),
|
test.A("example.com. 5000 IN A 192.0.2.43"),
|
||||||
|
@ -299,7 +299,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Answer: []dns.RR{
|
Answer: []dns.RR{
|
||||||
test.AAAA("example.com. 60 IN AAAA 64:ff9b::192.0.2.42"),
|
test.AAAA("example.com. 60 IN AAAA 64:ff9b::192.0.2.42"),
|
||||||
test.AAAA("example.com. 600 IN AAAA 64:ff9b::192.0.2.43"),
|
test.AAAA("example.com. 600 IN AAAA 64:ff9b::192.0.2.43"),
|
||||||
|
@ -315,7 +315,7 @@ func TestDNS64(t *testing.T) {
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
Opcode: dns.OpcodeQuery,
|
Opcode: dns.OpcodeQuery,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
},
|
},
|
||||||
initResp: &dns.Msg{ // failure
|
initResp: &dns.Msg{ // failure
|
||||||
MsgHdr: dns.MsgHdr{
|
MsgHdr: dns.MsgHdr{
|
||||||
|
@ -325,7 +325,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeNameError,
|
Rcode: dns.RcodeNameError,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
||||||
},
|
},
|
||||||
resp: &dns.Msg{
|
resp: &dns.Msg{
|
||||||
|
@ -336,7 +336,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeNameError,
|
Rcode: dns.RcodeNameError,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
Ns: []dns.RR{test.SOA("example.com. 3600 IN SOA foo bar 1 7200 900 1209600 86400")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -349,7 +349,7 @@ func TestDNS64(t *testing.T) {
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
Opcode: dns.OpcodeQuery,
|
Opcode: dns.OpcodeQuery,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
},
|
},
|
||||||
|
|
||||||
initResp: &dns.Msg{
|
initResp: &dns.Msg{
|
||||||
|
@ -360,7 +360,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Answer: []dns.RR{
|
Answer: []dns.RR{
|
||||||
test.AAAA("example.com. 60 IN AAAA ::1"),
|
test.AAAA("example.com. 60 IN AAAA ::1"),
|
||||||
test.AAAA("example.com. 5000 IN AAAA ::2"),
|
test.AAAA("example.com. 5000 IN AAAA ::2"),
|
||||||
|
@ -375,7 +375,7 @@ func TestDNS64(t *testing.T) {
|
||||||
Rcode: dns.RcodeSuccess,
|
Rcode: dns.RcodeSuccess,
|
||||||
Response: true,
|
Response: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{dns.Question{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
|
||||||
Answer: []dns.RR{
|
Answer: []dns.RR{
|
||||||
test.AAAA("example.com. 60 IN AAAA ::1"),
|
test.AAAA("example.com. 60 IN AAAA ::1"),
|
||||||
test.AAAA("example.com. 5000 IN AAAA ::2"),
|
test.AAAA("example.com. 5000 IN AAAA ::2"),
|
||||||
|
|
|
@ -205,7 +205,7 @@ func (f *Forward) ForceTCP() bool { return f.opts.forceTCP }
|
||||||
func (f *Forward) PreferUDP() bool { return f.opts.preferUDP }
|
func (f *Forward) PreferUDP() bool { return f.opts.preferUDP }
|
||||||
|
|
||||||
// List returns a set of proxies to be used for this client depending on the policy in f.
|
// List returns a set of proxies to be used for this client depending on the policy in f.
|
||||||
func (f *Forward) List() []*Proxy {return f.p.List(f.proxies)}
|
func (f *Forward) List() []*Proxy { return f.p.List(f.proxies) }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ErrNoHealthy means no healthy proxies left.
|
// ErrNoHealthy means no healthy proxies left.
|
||||||
|
|
|
@ -79,17 +79,17 @@ func TestExternal(t *testing.T) {
|
||||||
|
|
||||||
type external struct{}
|
type external struct{}
|
||||||
|
|
||||||
func (external) HasSynced() bool { return true }
|
func (external) HasSynced() bool { return true }
|
||||||
func (external) Run() {}
|
func (external) Run() {}
|
||||||
func (external) Stop() error { return nil }
|
func (external) Stop() error { return nil }
|
||||||
func (external) EpIndexReverse(string) []*object.Endpoints { return nil }
|
func (external) EpIndexReverse(string) []*object.Endpoints { return nil }
|
||||||
func (external) SvcIndexReverse(string) []*object.Service { return nil }
|
func (external) SvcIndexReverse(string) []*object.Service { return nil }
|
||||||
func (external) Modified() int64 { return 0 }
|
func (external) Modified() int64 { return 0 }
|
||||||
func (external) EpIndex(s string) []*object.Endpoints { return nil }
|
func (external) EpIndex(s string) []*object.Endpoints { return nil }
|
||||||
func (external) EndpointsList() []*object.Endpoints { return nil }
|
func (external) EndpointsList() []*object.Endpoints { return nil }
|
||||||
func (external) GetNodeByName(ctx context.Context, name string) (*api.Node, error) { return nil, nil }
|
func (external) GetNodeByName(ctx context.Context, name string) (*api.Node, error) { return nil, nil }
|
||||||
func (external) SvcIndex(s string) []*object.Service { return svcIndexExternal[s] }
|
func (external) SvcIndex(s string) []*object.Service { return svcIndexExternal[s] }
|
||||||
func (external) PodIndex(string) []*object.Pod { return nil }
|
func (external) PodIndex(string) []*object.Pod { return nil }
|
||||||
|
|
||||||
func (external) GetNamespaceByName(name string) (*api.Namespace, error) {
|
func (external) GetNamespaceByName(name string) (*api.Namespace, error) {
|
||||||
return &api.Namespace{
|
return &api.Namespace{
|
||||||
|
|
|
@ -103,7 +103,9 @@ func (APIConnTest) EpIndexReverse(ip string) []*object.Endpoints {
|
||||||
return eps
|
return eps
|
||||||
}
|
}
|
||||||
|
|
||||||
func (APIConnTest) GetNodeByName(ctx context.Context, name string) (*api.Node, error) { return &api.Node{}, nil }
|
func (APIConnTest) GetNodeByName(ctx context.Context, name string) (*api.Node, error) {
|
||||||
|
return &api.Node{}, nil
|
||||||
|
}
|
||||||
func (APIConnTest) GetNamespaceByName(name string) (*api.Namespace, error) {
|
func (APIConnTest) GetNamespaceByName(name string) (*api.Namespace, error) {
|
||||||
return &api.Namespace{}, nil
|
return &api.Namespace{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const name = "whoami"
|
const name = "whoami"
|
||||||
|
|
||||||
// Whoami is a plugin that returns your IP address, port and the protocol used for connecting
|
// Whoami is a plugin that returns your IP address, port and the protocol used for connecting
|
||||||
// to CoreDNS.
|
// to CoreDNS.
|
||||||
type Whoami struct{}
|
type Whoami struct{}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue