| Age | Commit message (Collapse) | Author |
|
|
|
With help of spdxconv tool [1], we able to bulk update all files license
and copyright format to comply with SPDX formats.
[1] https://kilabit.info/project/spdxconv/
|
|
The "nolint" tag is used to ignore lines from being processed by
golangci-lint.
Since we are not using golangci-lint anymore, now and in the
future, those lines can be removed.
|
|
Go 1.22 now support for-range on numeric value.
|
|
For HTTP server that use TLS, set the minimum TLS version and
ReadHeaderTimeout to mitigate slowloris attack.
For HTTP client or server that parameterize the use of InsecureSkipVerify,
annotate the line with "nolint:gosec" to allow the code pass the check.
Library that still use sha1, in example in DKIM and TOTP, skip the
warnings by annotating the line with "nolint:gosec".
A pointer variable now allocated their address before assigning its
value.
Any error that returned now wrapped using "%w".
Also, replace error checking using [errors.Is] or [errors.As] instead of
using equal or not-equal operators.
In "lib/http", replace any usage of "math/rand" with "crypto/rand".
Any call of [math/big.Rat.SetString] now annotated with "nolint:gosec"
since its false positive, the issue has been fixed in Go >= 1.17.7.
Any switch case that does not cover the rest of the possible values now
handled by adding the cases or by replacing the "default" case with
the rest of values.
|
|
HTTP request now implicitly create request with context.
Any false positive related to not closing HTTP response body has been
annotated with "nolint:bodyclose".
In the example code, use consistent "// Output:" comment format, by
prefixing with single space.
Any comment on code now also prefixing with single space.
An error returned without variables now use [errors.New] instead of
[fmt.Errorf].
Any error returned using [fmt.Errorf] now wrapped using "%w" instead of
"%s".
Also, replace error checking using [errors.Is] or [errors.As], instead
of using equal/not-equal operator.
Any statement like "x = x OP y" now replaced with "x OP= y".
Also, swap statement is simplified using "x, y = y, x".
Any switch statement with single case now replaced with if-condition.
Any call to defer on function or program that call [os.Exit], now
replaced by calling the deferred function directly.
Any if-else condition now replaced with switch statement, if possible.
|
|
There are several reasons that why we move from github.com.
First, related to the name of package.
We accidentally name the package with "share" a common word in English
that does not reflect the content of repository.
By moving to other repository, we can rename it to better and unique
name, in this "pakakeh.go".
Pakakeh is Minang word for tools, and ".go" suffix indicate that the
repository related to Go programming language.
Second, supporting open source.
The new repository is hosted under sourcehut.org, the founder is known
to support open source, and all their services are licensed under AGPL,
unlike GitHub that are closed sources.
Third, regarding GitHub CoPilot.
The GitHub Terms of Service [1], allow any public content that are hosted
there granted them to parse the content.
On one side, GitHub helps and flourish the open source, but on another
side have an issues regarding scraping the copyleft license [2].
[1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us
[2]: https://githubcopilotinvestigation.com
|
|
According to RFC 6376,
To avoid denial-of-service attacks, implementations MAY consider any
value longer than 12 digits to be infinite.
Since ExpiredAt type is uint64, we cannot set it to infinite, so set it
to maximum value int64 (not maximum of uint64).
|
|
The realignment reduce the cost of the following struct,
* struct in TestNewDNSClientPool: from 64 to 56 bytes (-8 bytes)
* Key: from 160 to 144 bytes (-16 bytes)
* struct in TestKeyParseTXT: from 48 to 40 bytes (-8 bytes)
* KeyPool: from 16 to 8 bytes (-8 bytes)
* Signature: from 256 to 240 bytes (-16 bytes)
* struct in TestSignatureHash: from 48 to 40 bytes (-8 bytes)
* struct in TestSignatureSign: from 80 to 64 bytes (-16 bytes)
* struct in TestSignatureVerify: from 72 to 64 bytes (-8 bytes)
* Status: from 48 to 24 bytes (-24 bytes)
* tag: from 16 to 8 bytes (-8 bytes)
|
|
The libio.Reader will be deprecated and replaced with libbytes.Parser
in the future.
|
|
|
|
Due to external DNS records are unpredictable, some test may failed
in the future.
|
|
|
|
Since Go 1.16, the ioutil package has been deprecated.
This changes replace any usage that use functions from ioutil package
with their replacement from package os or package io.
|
|
The domain now return invalid public key record, so we removed them
to make the test passed for now.
|
|
Previously, Lookup() method on Client pass the question name, type, and
class as parameters.
This changes make those parameters into MessageQuestion.
|
|
|
|
Previously, the test.Assert and test.AssertBench functions has the
boolean parameter to print the stack trace of test in case its not equal.
Since this parameter is not mandatory and its usually always set to
"true", we remove them from function signature to simplify the call
to Assert and AssertBench.
|
|
There are two reasons for this changes. First, to allow JSON encoded
of ResourceRecord.Value without encoded to base64.
Second, to minimize unreleased packet due to the backing storage is
still used when assigned to Value (or any []byte field in RDataXXX).
|
|
|
|
|
|
|
|
This fix flaky test issue on macOS that display expired time
in local time.
|
|
TODO: replace DNS with local server.
|
|
|
|
|
|
|
|
This library previously part of bytes package. To make it bytes package
consistent (only working with slice of byte), we move all ASCII related
constants, variables, and functions into new package.
|
|
The valid syntax to suppress linter warnings is "//nolint:<name>" with
no space between comment and "nolint" and between ":". Also, we move the
placement of nolint directive to the top of statements for multiple
nolint in the same scope.
While at it, fix and supress some linter warnings.
|
|
|
|
Most of the warnings caused by update to linter which cause global
variables declared with grouping "( ... )" and that has been suppressed,
are become false-positive again.
|
|
|
|
Since most of constants is not required to be overlap (two or more state
in one variable), we can simplify the declaration of iota without using
shift left.
|
|
Everything seems like works in order, we need more test will real life
message.
|
|
Each message will have DKIMSignature field and dkimStatus that contains
the message signature, if available, and their status.
|
|
The meaning of verify is for verifying the signature later with the
message.
|
|
The name of "Verify" may confuse reader with DKIM verify process.
|
|
|
|
Also, add more unit test for creating DNS client pool.
|
|
* HashAlg: Add unit test for unpacking hash algorithms.
* Key,
* make Type to be nil-able. Nil value on Type means its not defined and
will not print the default when packing;
* check for empty parameter on ParseTXT and lookupDNSTXT;
* check for DNS message response code; and
* make the Pack() method return compact text, without printing default
key value.
* KeyFlag: prevent duplicate flags.
* Signature,
* check the value immediately on set();
* add more unit test cases.
|
|
Implementor of this library can use the KeyPool.Get method to retrieve key
instead of LookupKey to minimize network traffic and process to decode and
parse public key.
This changes affect how we call LookupKey.
|
|
|
|
|
|
Also, comment the global variables to describe their meanings.
|
|
This implementation is based on RFC 6376 section 3.6 Key Management and
Representation.
|
|
A single query method is required for function to lookup public key.
|
|
While at it, update documentation on DKIM Signatures.
|