New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSIG Verify/Generate using TsigProvider #1379
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,10 +166,12 @@ type timerWireFmt struct { | |
// timersOnly is false. | ||
// If something goes wrong an error is returned, otherwise it is nil. | ||
func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) ([]byte, string, error) { | ||
return tsigGenerateProvider(m, tsigHMACProvider(secret), requestMAC, timersOnly) | ||
return TsigGenerateProvider(m, tsigHMACProvider(secret), requestMAC, timersOnly) | ||
} | ||
|
||
func tsigGenerateProvider(m *Msg, provider TsigProvider, requestMAC string, timersOnly bool) ([]byte, string, error) { | ||
// TsigGenerate fills out the TSIG record attached to the message using | ||
// a TsigProvider, for more details and return see TsigGenerate. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also unfinished docs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
func TsigGenerateProvider(m *Msg, provider TsigProvider, requestMAC string, timersOnly bool) ([]byte, string, error) { | ||
if m.IsTsig() == nil { | ||
panic("dns: TSIG not last RR in additional") | ||
} | ||
|
@@ -223,7 +225,9 @@ func TsigVerify(msg []byte, secret, requestMAC string, timersOnly bool) error { | |
return tsigVerify(msg, tsigHMACProvider(secret), requestMAC, timersOnly, uint64(time.Now().Unix())) | ||
} | ||
|
||
func tsigVerifyProvider(msg []byte, provider TsigProvider, requestMAC string, timersOnly bool) error { | ||
// TsigVerify verifies the TSIG on a message using a TsigProvider, for | ||
// more details and return see TsigVerify. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this comments isn't finished. 'for more details ... ?' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It says |
||
func TsigVerifyProvider(msg []byte, provider TsigProvider, requestMAC string, timersOnly bool) error { | ||
return tsigVerify(msg, provider, requestMAC, timersOnly, uint64(time.Now().Unix())) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the docs - it's weirdly formatted, also Tsig RR -> TSIG RR..
"... called for the first time requestMAC should be set to the empty string and timersOnly should be false.":
would also be nice to tell what subsequent calls should look like,.
The "if something goes wrong an error is returned..." can be removed IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made no change in the documentation for that function.