aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-07-09share v0.8.0v0.8.0Shulhan
=== Breaking changes * All ASCII related contants and functions now being moved from `bytes` package to `ascii` package. === New Features * ascii: new library for working with ASCII characters === Enhancements * dns: add method to restart forwarders * dns: add fallback nameservers * ini: create new section or variable if not exist on Set
2019-07-09dns: use channel to stop all forwardersShulhan
Previously, we use a boolean condition to stop all forwarders by setting it to false. But, this method does not work because using select statement with single case, will block the process. This change, allocated a new boolean channel for each forwarders, that is stored on server fields and when we need to stop or restart all forwarders, we send the boolean value "true" to each channel.
2019-07-09ini: add an empty line before section statementShulhan
For readibility, each section should start with an empty line.
2019-06-24dns: replace goto with boolean condition for restarting UDP forwarderShulhan
2019-06-24dns: recreate the DoH forwarder when query failShulhan
When query with DoH forwarder return an error, we assume that there is a problem with the connection. To mitigate the problem when subsequent query using broken connection return an error, we close the forwarder connection and create a new one.
2019-06-18dns: add fallback nameserversShulhan
The fallback nameservers is another list of parent name servers that will be queried if the primary NameServers return an error.
2019-06-18ini: create new section or variable if not exist on SetShulhan
Previous behaviour of Set() method will return false if the section or subsection of key to be set not found on database. This commit change the behaviour of Set(). If no section or subsection found on database, the new section with key-value will be created. If no key found, the new key-value will be added to the specific section.
2019-06-16dns: add method to restart forwardersShulhan
The RestartForwarders method allow server to change the parent nameserver address to new one. An example of use case is when system change the network through WiFi, which cause the nameserver address also change in the resolv.conf file.
2019-06-14ascii: new library for working with ASCII charactersShulhan
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.
2019-06-14share v0.7.0v0.7.0Shulhan
This release bring major refactoring on `ini` package to provide a clean and simple API. === Breaking Changes * ini: major refactoring * net: add parameter to check Fully Qualified Domain Name on IsHostnameValid === New Features * spf: implementation of Sender Policy Framework (RFC 7208) * ssh: package ssh provide a wrapper to golang.org/x/crypto/ssh === Enhancements * dns: add function to lookup PTR record by IP address * dns: export Lookup method as part of Client interface * doc: regenerate to use new style * http: print the not-found path on Server's getFSNode() * ini: add method Vars that return all variables as map * ini: add method to Rebase other INI object * ini: add method to add, set, and unset variable * ini: add method to convert key-value to map * ini: add method to get section object by section and/or subsection name * ini: add method to get variable values as slice of string * ini: add method to prune INI variables * ini: add methods to support templating * io: add function to check if content of file is binary * net: add function to check if IP address is IPv4 or IPv6 * net: add function to convert IPv6 into dot format * ns: set log flag to 0, without time prefix * strings: add function to append uniq values to slice of strings === Bug Fixes * io: watch changes on sub of sub directories on DirWatcher * dns: substract the message TTL when the answer found on cache * dns: always return true when answers RR exist and no TTL is zero
2019-06-14README: add short documentation and link for "smtpcli"Shulhan
Command smtpcli provide a command line interface to SMTP client protocol.
2019-06-14memfs: fix test on GeneratePathNodeShulhan
2019-06-14smtp: fix test on Lookup ip addressShulhan
2019-06-14go.mod: update dependenciesShulhan
2019-06-14CHANGELOG: preparing for release v0.7.0Shulhan
2019-06-14all: fix nolint formatShulhan
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.
2019-06-13ssh/client: add recursive option for Get and Put commandsShulhan
2019-06-07ini: add method to get section object by section and/or subsection nameShulhan
2019-06-03ssh: add field Environments in client's configShulhan
The field Environments contains system environment variables that will be passed to Execute.
2019-06-02ini: add method Vars that return all variables as mapShulhan
Given a section name and/or subsection name, Vars() method will return all variables as map of key and value. If there is a duplicate in key's name, only the last key value that will be store on map value. This method is a shortcut that can be used in templating.
2019-06-02ini: add parameter section and subsection nameShulhan
If section name is not empty, only the keys will be listed in the map.
2019-06-02io: add function to check if content of file is binaryShulhan
Basically, the function count the ratio between printable characters for the first 512 bytes or more, excluding spaces. If the ratio is greater than 75% then its a text; otherwise its a binary.
2019-05-26ini: add methods to support templatingShulhan
The following methods are added to support templating using this package, * Subs(): a method that return all non-empty subsections * Val(): a method that return the last variable's value using key's path as combination of section-name ":" sub-section-name ":" key. * Vals(): a method that return all variable values as slice of string This changes cause the section type to be exported back, again.
2019-05-26ini: escape the variable value when printing with StringShulhan
If the variable is quoted, the value must be escaped so the following character are allowed: '\b', '\n', '\t', '\\', and '\"'.
2019-05-26ini: add method to add, set, and unset variableShulhan
The Add() method will add new key and value to the last item in section and/or subsection. The Set() method set the last variable's value in section-subsection that match with the key. The Unset() method will remove the last variable's in section and/or subsection that match with the key.
2019-05-26ini: refactoring section methodsShulhan
This is the fifth part of refactoring ini package. Some of the changes, * add() now will append the new variable if the same already exist but the value is different. * remove unused getFirstIndex() method * add method getVariable() that return the last variable in the section by key * set() method will not add or append new variable if key is not exist, instead it will return false. * unset() method will remove the last variable on section, even if key is duplicate.
2019-05-26ini: replace multiple ifs conditions with switch statementShulhan
This is the third part of refactoring ini package. The change affect on how variable value being fetched and formatted.
2019-05-26ini: remove unused cases in variable's StringShulhan
The lineModeSection and lineModeSubsection on variable's String switch cases is previously used to print section and/or subsection before the section is moved to its own type.
2019-05-25ini: rename varModeXXX to lineModeXXXShulhan
This is the second part of refactoring to provide clean and readable code.
2019-05-25ini: unexport Variable and SectionShulhan
This is the first part to refactoring ini package to provide a clean and simple API.
2019-05-25ini: add method to Rebase other INI objectShulhan
Basically, Rebase merge each sections in other INI object on top of current INI object.
2019-05-25ini: add method to prune INI variablesShulhan
Pruning the INI variables means removing the empty lines, the comments, and merge section and subsection that have the same name into one group.
2019-05-25ini: reorder all methods by nameShulhan
2019-05-25ini: cleanup, reformat, and repharase commentsShulhan
2019-05-25ini: remove unused method AddNewLineShulhan
2019-05-25ini: split doc into its own fileShulhan
While at it, reformat and fix numbering on Variable rules.
2019-05-25ini: use direct constant declaration instead of iotaShulhan
Using iota we need to comment the constants value. By declaring the value directly, it gives more clear statement.
2019-05-25ini: add method to get variable values as slice of stringShulhan
2019-05-25strings: move the Uniq function to strings.goShulhan
2019-05-25ssh: package ssh provide a wrapper to golang.org/x/crypto/sshShulhan
This package provide a simple client initialization with additional methods to copy file from local or remote using scp.
2019-05-25ini: add method to convert key-value to mapShulhan
AsMap return the INI contents as mapping of (section "." subsection "." var) as key and the variable's value as slice of string. For example, given the following INI file, [section1] key = value [section2 "sub"] key2 = value2 key2 = value3 it will be mapped as, map["section1..key"] = []string{"value"} map["section2.sub.key2"] = []string{"value2", "value3"}
2019-05-25strings: add function to append uniq values to slice of stringsShulhan
The AppendUniq will append a string to slice only if the same string its not already exist. The string is compared in case insensitive manner.
2019-05-21dns: always return true when answers RR exist and no TTL is zeroShulhan
Previous IsExpired() will return true if answers exist but one of TTL in authority or additional RR is zero. Since authority and additional RR are complementary, any Message with EDNS that by default have zero TTL will always return true. This change check TLL expiration only on answers. As long as the answers RR exist and no zero TTL it will return false. We also remove zero TTL check on additional RR due to default zero value for EDNS message.
2019-05-21dns: use the "lib/net" package to reverse the IPv6 addressShulhan
2019-05-21net: add function to convert IPv6 into dot formatShulhan
This function only useful for expanding SPF macro "i" or when generating query for DNS PTR.
2019-05-21spf: implementation of Sender Policy Framework (RFC 7208)Shulhan
2019-05-18doc: regenerate to use new styleShulhan
Since the library (this packages) is for Go, the new style try to use the same layout and format with Go doc style as in golang.org.
2019-05-18net: add function to check if IP address is IPv4 or IPv6Shulhan
Currently, the standard library does not provide a function to check if IP is IPv4 or IPv6. This is a naive implementation that check IP version based on dot or colon.
2019-05-17dns: set log flag to 0, without time prefixShulhan
2019-05-17dns: add function to lookup PTR record by IP addressShulhan
The function LookupPTR accept any IP address (either IPv4 or IPv6) and return a single domain name on success or an error on failed. If IP address does not have PTR record it will return empty string without error.