mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-07 00:23:44 +08:00
Placate VS Code's linter
This commit is cosmetic changes to the code (no change in functionality). We must mollify the linter, for to do otherwise would risk wrath.
This commit is contained in:
18
xip/xip.go
18
xip/xip.go
@@ -226,7 +226,7 @@ func NewXip(blocklistURL string, nameservers []string, addresses []string, deleg
|
|||||||
// Parse and set our nameservers
|
// Parse and set our nameservers
|
||||||
for _, ns := range nameservers {
|
for _, ns := range nameservers {
|
||||||
if len(ns) == 0 {
|
if len(ns) == 0 {
|
||||||
logmessages = append(logmessages, fmt.Sprintf(`-nameservers: ignoring zero-length nameserver ""`))
|
logmessages = append(logmessages, `-nameservers: ignoring zero-length nameserver ""`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// all nameservers must be absolute (end in ".")
|
// all nameservers must be absolute (end in ".")
|
||||||
@@ -473,8 +473,7 @@ func (x *Xip) processQuestion(q dnsmessage.Question, srcAddr net.IP) (response R
|
|||||||
case dnsmessage.TypeCNAME:
|
case dnsmessage.TypeCNAME:
|
||||||
{
|
{
|
||||||
// If there is a CNAME, there can only be 1, and only from Customizations
|
// If there is a CNAME, there can only be 1, and only from Customizations
|
||||||
var cname *dnsmessage.CNAMEResource
|
cname := CNAMEResource(q.Name.String())
|
||||||
cname = CNAMEResource(q.Name.String())
|
|
||||||
if cname == nil {
|
if cname == nil {
|
||||||
// No Answers, only 1 Authorities
|
// No Answers, only 1 Authorities
|
||||||
soaHeader, soaResource := SOAAuthority(q.Name)
|
soaHeader, soaResource := SOAAuthority(q.Name)
|
||||||
@@ -621,9 +620,7 @@ func (x *Xip) processQuestion(q dnsmessage.Question, srcAddr net.IP) (response R
|
|||||||
var logMessageTXTss []string
|
var logMessageTXTss []string
|
||||||
for _, txt := range txts {
|
for _, txt := range txts {
|
||||||
var logMessageTXTs []string
|
var logMessageTXTs []string
|
||||||
for _, TXTstring := range txt.TXT {
|
logMessageTXTs = append(logMessageTXTs, txt.TXT...)
|
||||||
logMessageTXTs = append(logMessageTXTs, TXTstring)
|
|
||||||
}
|
|
||||||
logMessageTXTss = append(logMessageTXTss, `["`+strings.Join(logMessageTXTs, `", "`)+`"]`)
|
logMessageTXTss = append(logMessageTXTss, `["`+strings.Join(logMessageTXTs, `", "`)+`"]`)
|
||||||
}
|
}
|
||||||
if len(logMessageTXTss) == 0 {
|
if len(logMessageTXTss) == 0 {
|
||||||
@@ -633,8 +630,7 @@ func (x *Xip) processQuestion(q dnsmessage.Question, srcAddr net.IP) (response R
|
|||||||
}
|
}
|
||||||
case dnsmessage.TypePTR:
|
case dnsmessage.TypePTR:
|
||||||
{
|
{
|
||||||
var ptr *dnsmessage.PTRResource
|
ptr := x.PTRResource([]byte(q.Name.String()))
|
||||||
ptr = x.PTRResource([]byte(q.Name.String()))
|
|
||||||
if ptr == nil {
|
if ptr == nil {
|
||||||
// No Answers, only 1 Authorities
|
// No Answers, only 1 Authorities
|
||||||
soaHeader, soaResource := SOAAuthority(dnsmessage.MustNewName("sslip.io."))
|
soaHeader, soaResource := SOAAuthority(dnsmessage.MustNewName("sslip.io."))
|
||||||
@@ -1195,8 +1191,7 @@ func (x *Xip) blocklist(hostname string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *Xip) nameToAwithBlocklist(q dnsmessage.Question, response Response, logMessage string) (_ Response, _ string, err error) {
|
func (x *Xip) nameToAwithBlocklist(q dnsmessage.Question, response Response, logMessage string) (_ Response, _ string, err error) {
|
||||||
var nameToAs []dnsmessage.AResource
|
nameToAs := NameToA(q.Name.String(), x.Public)
|
||||||
nameToAs = NameToA(q.Name.String(), x.Public)
|
|
||||||
if len(nameToAs) == 0 {
|
if len(nameToAs) == 0 {
|
||||||
// No Answers, only 1 Authorities
|
// No Answers, only 1 Authorities
|
||||||
soaHeader, soaResource := SOAAuthority(q.Name)
|
soaHeader, soaResource := SOAAuthority(q.Name)
|
||||||
@@ -1307,8 +1302,7 @@ func IsPublic(ip net.IP) (isPublic bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *Xip) nameToAAAAwithBlocklist(q dnsmessage.Question, response Response, logMessage string) (_ Response, _ string, err error) {
|
func (x *Xip) nameToAAAAwithBlocklist(q dnsmessage.Question, response Response, logMessage string) (_ Response, _ string, err error) {
|
||||||
var nameToAAAAs []dnsmessage.AAAAResource
|
nameToAAAAs := NameToAAAA(q.Name.String(), x.Public)
|
||||||
nameToAAAAs = NameToAAAA(q.Name.String(), x.Public)
|
|
||||||
if len(nameToAAAAs) == 0 {
|
if len(nameToAAAAs) == 0 {
|
||||||
// No Answers, only 1 Authorities
|
// No Answers, only 1 Authorities
|
||||||
soaHeader, soaResource := SOAAuthority(q.Name)
|
soaHeader, soaResource := SOAAuthority(q.Name)
|
||||||
|
Reference in New Issue
Block a user