mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-04-04 12:27:36 +03:00
refactor: DNS
This commit is contained in:
parent
572ee775b1
commit
6c9e61a0a0
89 changed files with 4794 additions and 1733 deletions
33
dns/rcode.go
Normal file
33
dns/rcode.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package dns
|
||||
|
||||
import F "github.com/sagernet/sing/common/format"
|
||||
|
||||
const (
|
||||
RCodeSuccess RCodeError = 0 // NoError
|
||||
RCodeFormatError RCodeError = 1 // FormErr
|
||||
RCodeServerFailure RCodeError = 2 // ServFail
|
||||
RCodeNameError RCodeError = 3 // NXDomain
|
||||
RCodeNotImplemented RCodeError = 4 // NotImp
|
||||
RCodeRefused RCodeError = 5 // Refused
|
||||
)
|
||||
|
||||
type RCodeError uint16
|
||||
|
||||
func (e RCodeError) Error() string {
|
||||
switch e {
|
||||
case RCodeSuccess:
|
||||
return "success"
|
||||
case RCodeFormatError:
|
||||
return "format error"
|
||||
case RCodeServerFailure:
|
||||
return "server failure"
|
||||
case RCodeNameError:
|
||||
return "name error"
|
||||
case RCodeNotImplemented:
|
||||
return "not implemented"
|
||||
case RCodeRefused:
|
||||
return "refused"
|
||||
default:
|
||||
return F.ToString("unknown error: ", uint16(e))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue