<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pakakeh.go, branch v0.32.0</title>
<subtitle>Collections of packages and tools for working with Go programming language.</subtitle>
<id>http://git.kilabit.info/pakakeh.go/atom?h=v0.32.0</id>
<link rel='self' href='http://git.kilabit.info/pakakeh.go/atom?h=v0.32.0'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/'/>
<updated>2021-12-03T16:57:26Z</updated>
<entry>
<title>Release share v0.32.0 (2021-12-03)</title>
<updated>2021-12-03T16:57:26Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-12-03T16:57:26Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=2486cf63c7451c892ac509d0fe8b072473a89b7b'/>
<id>urn:sha1:2486cf63c7451c892ac509d0fe8b072473a89b7b</id>
<content type='text'>
This release bring major changes and enhancements to package dns and math/big.

===  Breaking changes

*  math/big: refactoring AddFloat to accept variadic interface{}

   Previously, the AddFloat function only accept two interface parameters.

   This changes make the AddFloat to accept many interface parameters.

*  math/big: refactor NewFloat to accept interface{} instead of float64 only

   The following types is added and can be initialized to Float: []byte,
   uint, uint16, uint32, uint64, big.Int, *big.Int, big.Rat, and *big.Rat.

*  math/big: refactoring the Rat

   The promise of this package is to provide the Rat type with RoundToZero
   and without panic.

   In order to do that we remove the MustRat() function and check for nil
   on pointer receiver before doing operation, and check for zero value
   when doing quotation.

   Another breaking changes are,

   * Humanize() with nil pointer receiver will return string "0"
   * Any IsXxx() methods with nil pointer receiver will return false
   * MarshalJSON() will nil pointer receiver will return "null" instead of
     "0" now

*  lib/dns: refactoring, change signature of client Lookup

   Previously, Lookup() method on Client pass the question name, type, and
   class as parameters.

   This changes make those parameters into MessageQuestion.

*  lib/dns: refactoring ZoneFile into Zone

   Reason: A Zone is not always represented by file, it just that in this
   package, it is.

   This changes rename the type ZoneFile into Zone.

*  lib/dns: refactoring message question

   Previously the type for message question section SectionQuestion.

   This changes, rename the type to MessageQuestion.

*  lib/dns: refactoring the section header

   This changes rename the SectionHeader into MessageHeader.

   The pack() method is optimized with the following results,

   benchmark                         old ns/op     new ns/op     delta
   BenchmarkMessageHeader_pack-8     66.2          21.7          -67.31%

   benchmark                         old allocs     new allocs     delta
   BenchmarkMessageHeader_pack-8     3              1              -66.67%

   benchmark                         old bytes     new bytes     delta
   BenchmarkMessageHeader_pack-8     32            16            -50.00%

   The unpack() method is simplified by minimizing the if-condition.

   This changes also fix the pack and unpack OpCode for value other then 0,
   due to wrong shift value, 2 instead of 3.

*  lib/dns: refactoring, introduce new type RecordClass

   Previously, the record class is represented by uint16 using prefix
   QueryClassXxx.

   This changes make the record class to be an independent type, to make
   code more strict (prevent passing invalid value), and readable.

*  lib/dns: refactoring, create type RecordType to represent type of RR

   Previously, we use uint16 to represent type for ResourceRecord Type or
   Question type.

   To make the code more strict, where parameter or return value, must be
   expected as record type, we add new type to represent the RR type:
   RecordType.

   This changes also rename any variable name of QType or qtype to RType
   or rtype because QType is misleading. The type defined the
   ResourceRecord to be queried not only question.

*  lib/dns: remove the fallback name servers (NS) from server options

   The original idea of fallback NS is to send the query to the one define
   to original resolv.conf, instead of using the one defined by user in
   ServerOptions NameServers, when an error occured.

   But, most of error usually caused by network (disconnected, time out),
   so re-sending query to fallback NS does not have any effect if the network
   it self is not working.

   This changes remove the unnecessary and complex fallback NS from
   server.

===  New features

*  lib/dns: add support to save and load caches to/from storage

   The CachesSave method write the non-local answers into an io.Writer,
   encoded with gob.

   The CachesLoad method load the gob encoded answers from an io.Reader.

*  lib/ssh: use agent defined by config or from environment variable

   Previously, we only check the environment variable SSH_AUTH_SOCK
   to decide whether the client identity will fetched from agent or
   from private key file.

   This changes use the GetIdentityAgent from config Section to derive the
   path to unix socket.  It will return an empty string if the IdentityAgent
   is set to "none" in the Section or when SSH_AUTH_SOCK is not exist or
   empty.

*  ssh/config: add support for section variable IdentityAgent

   There are four possible value for IdentityAgent: SSH_AUTH_SOCK,
   &lt;$STRING&gt;, &lt;PATH&gt;, or "none".
   If SSH_AUTH_SOCK, the socket path is read from the environment variable
   SSH_AUTH_SOCK.
   If value start with "$", then the socket path is set based on value of
   that environment variable.
   Other string beside "none" will be considered as path to socket.

===  Bug fixes

*  math/big: return nil on Quo and QuoRat instead of panic

   Previously, if the first parameter of Quo or the second/next parameters
   of QuoRat is not convertable to Rat or zero, the method/function will
   panic.

   This changes make it less intrusive, instead of panic we check for
   zero value and return nil immediately.

*  lib/dns: do not cache truncated answer

   Previously only answer with non-zero response code is ignored.

   This changes ignore also answer where response header is truncated.

===  Enhancements

*  lib/dns: realign all struct fields

   Turns out the struct that we frequently used, answer and resource_record,
   is not optimized.

     answer.go:15:13: struct with 56 pointer bytes could be 24 = 32 bytes
	 ...
     resource_record.go:24:21: struct with 56 pointer bytes could be 40 = 16

   This changes reorder all structs field to save space in memory.

*  lib/dns: make the TCP forwarders as complementary of UDP

   The TCP forwarders only active when client send the DNS request as TCP.
   When the server receive that request it should also forward the request
   as TCP not as UDP to prevent the truncated response.

   Another use case for TCP is when the response is truncated, the client
   will send the query back through TCP connection.  The server should
   forward this request using TCP instead of UDP.

*  lib/dns: use different packet between UDP and TCP messages

   Previously, all packet size for reading and sending the message is
   fixed to 4096, even on UDP.

   This changes set the UDP packet size maximum to 512 bytes and others to
   4096 bytes.

   While at it, minimize copying packet if its not reusable inside a method.
</content>
</entry>
<entry>
<title>math/big: refactoring AddFloat to accept variadic interface{}</title>
<updated>2021-12-03T16:20:38Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-12-03T16:20:38Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=25995a003bc9aaee245ad73742aab3abe345b724'/>
<id>urn:sha1:25995a003bc9aaee245ad73742aab3abe345b724</id>
<content type='text'>
Previously, the AddFloat function only accept two interface parameters.

This changes make the AddFloat to accept many interface parameters.
</content>
</entry>
<entry>
<title>math/big: refactor NewFloat to accept interface{} instead of float64 only</title>
<updated>2021-12-03T16:06:37Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-12-03T16:06:37Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=21346871224130878c50dc6a8cc8ecf6606c8ece'/>
<id>urn:sha1:21346871224130878c50dc6a8cc8ecf6606c8ece</id>
<content type='text'>
The following types is added and can be initialized to Float: []byte,
uint, uint16, uint32, uint64, big.Int, *big.Int, big.Rat, and *big.Rat.
</content>
</entry>
<entry>
<title>math/big: realign struct fields on unit tests</title>
<updated>2021-11-19T03:49:08Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-11-17T17:36:47Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=994f5ec88cc95da68e2e1d9eda6865aa1b3d3148'/>
<id>urn:sha1:994f5ec88cc95da68e2e1d9eda6865aa1b3d3148</id>
<content type='text'>
The following alignment reported and fixed by fieldaligment tool,

  float_test.go:103:13: struct with 16 pointer bytes could be 8
  float_test.go:254:13: struct with 16 pointer bytes could be 8
  big/float_test.go:302:13: struct with 32 pointer bytes could be 16
</content>
</entry>
<entry>
<title>math/big: refactoring the Rat</title>
<updated>2021-11-19T03:49:08Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-11-17T17:08:46Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=f542979c53b8f16b6a9904e6ea5b30963ef88852'/>
<id>urn:sha1:f542979c53b8f16b6a9904e6ea5b30963ef88852</id>
<content type='text'>
The promise of this package is to provide the Rat type with RoundToZero
and without panic.

In order to do that we remove the MustRat() function and check for nil
on pointer receiver before doing operation, and check for zero value
when doing quotation.

Another breaking changes are,

* Humanize() with nil pointer receiver will return string "0"
* Any IsXxx() methods with nil pointer receiver will return false
* MarshalJSON() will nil pointer receiver will return "null" instead of
  "0" now
</content>
</entry>
<entry>
<title>math/big: return nil on Quo and QuoRat instead of panic</title>
<updated>2021-11-17T03:41:27Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-11-17T03:41:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=ea0846a642f7a8bc0d07e776ff9ca64f9f27992d'/>
<id>urn:sha1:ea0846a642f7a8bc0d07e776ff9ca64f9f27992d</id>
<content type='text'>
Previously, if the first parameter of Quo or the second/next parameters
of QuoRat is not convertable to Rat or zero, the method/function will
panic.

This changes make it less intrunsive, instead of panic we check for
zero value and return nil immediately.
</content>
</entry>
<entry>
<title>lib/dns: refactoring, change signature of client Lookup</title>
<updated>2021-11-15T18:27:48Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-11-15T18:27:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=339a047adea6c13d294460b9d77b9b48fadcb003'/>
<id>urn:sha1:339a047adea6c13d294460b9d77b9b48fadcb003</id>
<content type='text'>
Previously, Lookup() method on Client pass the question name, type, and
class as parameters.

This changes make those parameters into MessageQuestion.
</content>
</entry>
<entry>
<title>lib/dns: check error on Decode() in caches.read</title>
<updated>2021-11-15T17:06:21Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-11-15T17:06:21Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=e3a7607a9483158997ceac13d121236acdbbabad'/>
<id>urn:sha1:e3a7607a9483158997ceac13d121236acdbbabad</id>
<content type='text'>
</content>
</entry>
<entry>
<title>lib/dns: remove ineffectual assignment to err in Server runTCPForwarder</title>
<updated>2021-11-15T17:05:57Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-11-15T17:05:57Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=dd54c98eb09a38e74dd0f1c141541cb2077fb1eb'/>
<id>urn:sha1:dd54c98eb09a38e74dd0f1c141541cb2077fb1eb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>lib/dns: refactoring ZoneFile into Zone</title>
<updated>2021-11-14T20:15:31Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-11-14T20:15:31Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=8d4919022dfedf99bdd4cdc1f87de97d72e1c083'/>
<id>urn:sha1:8d4919022dfedf99bdd4cdc1f87de97d72e1c083</id>
<content type='text'>
Reason: A Zone is not always represented by file, it just that in this
package, it is.

This changes rename the type ZoneFile into Zone.
</content>
</entry>
</feed>
