Mateusz Poliwczak
Mateusz Poliwczak
I replaced the Fd() with SyscallConn(), because the Fd() sets the fd to blocking mode, but It increases the allocation count. Before: ``` BenchmarkStatFile-4 1000000 1257 ns/op 97 B/op 2...
Didn't know about that behavior, but it might make sense to follow the glibc implementation, and add the AD flag to queries when `trust-ad` is present.
Thanks for including that link to the PowerDNS docs. It is even the default behavior of PowerDNS since 4.5.0. It can still affect programs when `trust-ad` is set and the...
LookupHost has even a different behaviour than the LookupTXT: ```go func main() { suffix := ".example.net." name := strings.Repeat("verylong.", 27)[:254-len(suffix)] + suffix fmt.Println(len(name), name) d, err := net.LookupHost(name) fmt.Println(d, err)...
Also it looks like XDG_*_DIR env vars do not override the user-dirs.dirs file, checked in firefox/chromium ``` const ( envDesktopDir = "XDG_DESKTOP_DIR" envDownloadDir = "XDG_DOWNLOAD_DIR" envDocumentsDir = "XDG_DOCUMENTS_DIR" envMusicDir =...
It even look like that env vars are completely ignored by firefox/chromium. I removed the `user-dirs.dirs` file and set the `XDG_DOWNLOAD_DIR` env var to a different directory and the downloaded...
You can use the `Bytes` method on `*ecdh.PublicKey` to convert it to `*ecdsa.PublicKey`, like so: ```go func ecdhToECDSAPublicKey(key *ecdh.PublicKey) *ecdsa.PublicKey { rawKey := key.Bytes() switch key.Curve() { case ecdh.P256(): return...
> What does it look like for PrivateKey? Not tested, but i think something like this should work: ```go key := &ecdsa.PrivateKey{ PublicKey: *ecdhToECDSAPublicKey(priv.PublicKey()), D: big.NewInt(0).SetBytes(priv.Bytes()), } ```
I think this proposal looks like this now: ```go package ecdsa // crypto/ecdsa // NewPrivateKeyFromECDH converts [*ecdh.PrivateKey] into [*PrivateKey]. // It panics when the [*ecdh.PrivateKey.Curve] is not one of [ecdh.P256],...
@mrwonko Yeah, right, but because there is only one error condition it might also be a bool instead. Either way is fine. ```go func NewPrivateKeyFromECDH(priv *ecdh.PrivateKey) (priv *ecdsa.PrivateKey, ok bool)...