summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-05-02Release share v0.46.0 (2023-05-02)v0.46.0Shulhan
This release deprecated lib/io and lib/parser. === Breaking changes * lib/reflect: remove the third return value from Marshal * lib/bytes: changes the DumpPrettyTable output format === New features * lib/os: merge some functions from lib/io * lib/strings: merge lib/parser here * lib/bytes: implement function ParseHexDump * lib/bytes: implement tokenize Parser * lib/bytes: add function TrimNull * lib/net: add method WriteTo to ResolvConf === Enhancements * lib/time: calculate the next event before notify the user on Scheduler run * lib/reflect: add option to skip processing struct field in Do/IsEqual === Chores * lib/reflect: use doEqual inside IsEqual * lib/time: replace lib/io#Reader with lib/bytes#Parser * lib/smtp: replace lib/io#Reader with lib/bytes#Parser * lib/dns: replace lib/io#Reader with lib/bytes#Parser * lib/http: replace lib/io#Reader with lib/bytes#Parser * lib/email: replace lib/io#Reader with lib/bytes#Parser * email/dkim: replace lib/io#Reader with lib/bytes#Parser * lib/hunspell: replace lib/io with lib/os * lib/hunspell: replace lib/parser with lib/strings * lib/http: replace lib/parser with lib/strings * lib/bytes: copy TokenFind to internal/bytes#TokenFind
2023-05-02lib/time: calculate the next event on Scheduler runShulhan
This allow user to call the Next method, to know the next time the scheduler will be triggered, after receiving the event.
2023-04-13lib/reflect: change the package name in Example to have _test suffixShulhan
Package name in test Example should be different with the actual package. This is to minimize leaking un-exported function or method in Example test.
2023-04-13lib/reflect: use doEqual inside IsEqualShulhan
Previously, IsEqual internally use isEqual, which have the same logic as doEqual. This changes minimize duplicate code between IsEqual and DoEqual, by calling doEqual for both of functions.
2023-04-13lib/reflect: add option to skip processing struct field in Do/IsEqualShulhan
A struct's field tagged with `noequal:""`, its value will not be processed for equality.
2023-04-13lib/reflect: remove the third return value from MarshalShulhan
The third, boolean, return value is redundant with the second error value.
2023-04-13lib/bytes: fix linter warnings from reviveShulhan
2023-04-13lib/bytes: move unit Test for Read and SkipLine to ExampleShulhan
Using an example not only test the code but also provide example snippet when opened in the godoc.
2023-04-13lib/bytes: change the package name in Example to have _test suffixShulhan
Package name in test Example should be different with the actual package. This is to minimize leaking un-exported functions or methods.
2023-04-13lib/ascii: change the package name in Example to have _test suffixShulhan
Package name in test Example should be different with the actual package. This is to minimize leaking un-exported functions or methods.
2023-04-09lib/io: mark the package as deprecatedShulhan
Also, mention the deprecation in the README along with lib/parser.
2023-04-09lib/os: copy lib/io#ConfirmYesNo to lib/osShulhan
The lib/io package will be deprecated in the future.
2023-04-09lib/net: refactoring resolv.conf parser using lib/bytes#ParserShulhan
The lib/io#Reader will be deprecated and replaced with lib/bytes#Parser in the future.
2023-04-09lib/time: replace lib/io#Reader with lib/bytes#ParserShulhan
The lib/io#Reader will be deprecated and replaced with lib/bytes#Parser in the future.
2023-04-09lib/smtp: replace lib/io#Reader with lib/bytes#ParserShulhan
The lib/io#Reader will be deprecated and replaced with lib/bytes#Parser in the future.
2023-04-09lib/bytes: add method ReadLine to ParserShulhan
The ReadLine method read until it found new line ('\n') or end of content, ignoring all delimiters. The returned line will not contain '\n'.
2023-04-09lib/dns: refactoring zoneParser using lib/bytes#ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-09lib/bytes: return the number of skipped chars on Skip(Horizontal)SpacesShulhan
2023-04-09lib/dns: refactoring ParseHostsFile using lib/bytes#ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-09lib/http: refactoring ParseResponseHeader using lib/bytes#ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-09lib/bytes: add method Remaining to ParserShulhan
The Remaining method return the copy of un-parsed content.
2023-04-08lib/io: refactoring ParseContentType using lib/bytes#ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-08lib/email: refactoring ParseBodyPart using libbytes.ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-08lib/email: refactoring ParseMailboxes using lib/bytes#ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-08lib/email: replace lib/io#Reader with lib/bytes#ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-08email/dkim: replace lib/io#Reader with lib/bytes#ParserShulhan
The libio.Reader will be deprecated and replaced with libbytes.Parser in the future.
2023-04-08lib/bytes: add various methods to ParserShulhan
The AddDelimiters method add another delimiters to the current parser. The ReadNoSpace method read the next token by ignoring the leading spaces, even if its one of the delimiter. The returned token will have no trailing spaces. The RemoveDelimiters method remove delimiters delims from current delimiters. The Reset method set all internal state to new content and delimiters. The SetDelimiters method replace the current delimiters with delims. The SkipHorizontalSpaces method skip space (" "), tab ("\t"), carriage return ("\r"), and form feed ("\f") characters; and return the first non-space character or 0 if it reach end-of-content. The SkipSpaces method skip all spaces character (' ', '\f', '\n', '\r', '\t') and return the first non-space character or 0 if it reach end-of-content. The Stop method stop the parser, return the remaining unparsed content and its last position, and then call Reset to reset the internal state back to zero. The UnreadN method unread N characters and return the character its pointed to. If N greater than current position index, it will reset the read pointer index back to zero.
2023-04-08lib/hunspell: replace lib/io with lib/osShulhan
Function Copy in lib/io has been deprecated.
2023-04-08lib/os: add comment to error ErrExtractInputExtShulhan
2023-04-08lib/os: merge some functions from lib/ioShulhan
Functions like Copy, IsBinary, IsDirEmpty, IsFileExist, RmdirEmptyAll are read and operate on file and directory on operating system level, so it is not correct to put it in package io.
2023-04-05lib/hunspell: replace lib/parser with lib/stringsShulhan
The lib/parser has been deprecated.
2023-04-05lib/http: replace lib/parser with lib/stringsShulhan
The lib/parser has been deprecated.
2023-04-05lib/strings: fix warnings from linter reviveShulhan
2023-04-05lib/strings: merge lib/parser hereShulhan
The first idea of parser is to provide generic parser for both bytes and string. After we introduce lib/parser there is not much changes to that package. Also, since we create another Parser in lib/bytes that accept and return token as []byte, the lib/parser is not unique anymore. The following function/methods changes to minimize conflict in the future, * Lines become LinesOfFile * New become NewParser * Open become OpenForParser * Token become Read * TokenEscaped become ReadEscaped * TokenTrimSpace become ReadNoSpace
2023-04-05lib/bytes: implement function ParseHexDumpShulhan
The ParseHexDump parse the default output of [hexdump](1) utility from parameter in back into stream of byte. An example of default output of hexdump is 0000000 7865 5f70 6964 2f72 0000 0000 0000 0000 0000010 0000 0000 0000 0000 0000 0000 0000 0000 * 0000060 0000 0000 3030 3030 3537 0035 3030 3130 The first column is the address and the rest of the column is the data. Each data column is 16-bit words in big-endian order, so in the above example, the first byte would be 65, second byte is 78 and so on. The asterisk "*" means that the address from 0000020 to 0000050 is equal to the previous line, 0000010. [hexdump]: https://man.archlinux.org/man/hexdump.1
2023-04-05lib/bytes: implement tokenize ParserShulhan
The Parser type parse stream of byte using one or more delimiters as separator between token.
2023-04-05lib/bytes: add function TrimNullShulhan
The TrimNull function remove 0 value ("\0" or NULL in C) at leading and trailing of input.
2023-04-04lib/websocket: fix test on RootRouteAddShulhan
Instead of comparing the Sprintf value, compare the expected and got directly.
2023-04-04lib/bytes: changes the DumpPrettyTable output formatShulhan
The change is to accommodate large bytes data, more than 0xFFFF. The hex address in the first column is increased to 8 digits, the characters compacted without space in between.
2023-04-03lib/bytes: copy TokenFind to internal/bytes#TokenFindShulhan
This is to prevent import cycle later when we use lib/test in bytes.
2023-04-02lib/net: add method WriteTo to ResolvConfShulhan
The WriteTo method write the ResolvConf as text.
2023-04-01Release share v0.45.0 (2023-04-01)v0.45.0Shulhan
This release set the Go version to 1.19. === Breaking changes * lib/net: changes the PopulateQuery logic === New features * _bin: add shell script go-test-lint.sh to run test and lint sequentially * lib/bytes: add function DumpPrettyTable * lib/bytes: add function SplitEach * lib/dns: add function ParseZone * lib/dns: add method WriteTo to Zone * lib/http: add function to parse multipart Range response for Client * lib/http: add support for HTTP Range in Server * lib/io: add method ReplaceAll on Reader * lib/parser: add method TokenTrimSpace * lib/parser: add method SetDelimiters * lib/telemetry: new package for collecting and forwarding metrics === Bug fixes * lib/dns: fix packing, parsing, and saving MINFO resource data * lib/dns: fix packing and unpacking resource record HINFO * lib/dns: fix parsing SRV record from zone file === Enhancements * lib/dns: allow parsing TXT rdata without quote in zone file * lib/dns: handle zone file with CRLF line ending * lib/test: simplify the string diff output from Assert
2023-04-01all: update list of packages in the READMEShulhan
The following libraries has been added and not recorded, * lib/mlog * lib/os * lib/ssh/config * lib/telemetry * lib/test/mock
2023-03-26lib/telemetry: fix missing return error in CloseShulhan
2023-03-26cmd/agent-example: add collector for Go metricsShulhan
2023-03-26lib/telemetry: log the error from BulkForward on goroutine collectorShulhan
We use mlog so the user of telemetry can have record of error.
2023-03-26lib/http: check and log the error when writing response in handleRangeShulhan
We use the mlog, so user that also use mlog can record the error.
2023-03-26lib/http: fix empty branch when parsing rangeShulhan
If the range is "x-y-", the function should skip the position.
2023-03-26lib/email: remove unused variables in example of Header FilterShulhan
2023-03-26lib/net: changes the PopulateQuery logicShulhan
Previously, PopulateQuery only add the passed dname if the number of dots is greater than 0. After inspecting the result from dig and getenv, the dots seems does not affect the query. For example, if we have A record for domain "kilabit", both of those tools query name "kilabit" without adding local domain or domain in search.