- BREAKER OS signal handling is now managed within Petrel
itself. Applications can now just watch the channel
server.Sig
rather than having to create a channel and link it toos.Signal
events
- BREAKER The
mode
argument toserver.Register
has been removed- As a result, the
server.responder
type has been removed, and the server dispatch table now simply maps to functions
- As a result, the
- The
argv
mode has been removed. Only what was formerly known asblob
mode is now supported. This has resulted in further changes:- BREAKER
Responder
functions now take[]byte
instead of[][]byte
- BREAKER
client.Dispatch
now takes two args:req, payload []byte
rather than the request being the first "chunk" of the payload
- BREAKER
- Petrel wire protocol has changed
qsplit
dependency has been removed
- Msg level
All
is nowDebug
- Server configuration struct is now named
Config
rather thanServerConfig
- Client configuration struct is now named
Config
rather thanClientConfig
- Server configuration now specifies
Msglvl
as a string, which is the lowercase version of the Petrel constant (e.g. "debug" forDebug
). This makes application configuration, where the programmer shouldn't have to care about Petrel, more sane golint
cleanups
- The petrel client and server are now discrete subpackages within the module. No code changes other than those needed to make this new organization work
- See examples for updated usage; improved docs coming soon
- Various other changes to be more in-line with modern Golang project expectations
- Transition to Go module
- Removal of
petrel.Version
; obviated by module transition - Renamed
petrel.Protover
topetrel.Proto
- Code passed through 'goformat -s'. Also a few typo catches and similar cleanups.
- Internal changes to accomodate petreljs
- Binary encoding is now little-endian
- Transmission marshalling has been decoupled from connWrite.
- connWrite has been split into connWrite and connWriteRaw (the former calls the latter to do actual writing of data).
- connRead has been joined by connReadRaw, which reads from the connection without unmarshalling the transmission being read. connRead does not call connReadRaw.
- Client has a new method, DispatchRaw, which forwards transmissions to/from a server as-is.
- HMAC is now Base64 encoded rather than raw.
- The original demo client/server are now at demo/01-basic.
- The basic demo client/server now have a
-hmac
argument to allow transmitting with MACs. - Transmissions now have a sequence number.
- petrel.Client.Dispatch now returns:
- The transmission response
- The transmission sequence num
- An error
- The Petrel wire protocol now includes a 1-byte version identifier. A transmission with a version mismatch results in a terminated connection, as an HMAC mismatch does.
- Internal names cleanup
- ServerConfig.Reqlen is now a uint32 (was int), allowing a maximum request size of 4GB.
- Petrel now provides optional message authentication via crypto/HMAC
- Server constructors renamed to match Client ones.
- Client.Close is now Client.Quit, to match the Server shutdown method.
- OmitPrefix has been removed from ClientConfig. petrel.Client now always sends length-prefixed messages.
- Long manual-style godoc preamble removed in favor of more informative documentation for individual structs and methods.
- Reinstated demo client and server.
- Petrel and Pclient packages integrated.
- Name changes
- petrel.Config -> ServerConfig
- pclient.Config -> ClientConfig
- petrel.Handler -> petrel.Server -Handler.AddFunc -> Server.Register
- All constructors have been renamed (see go doc).
- Name changes
- New option in ServerConfig: Reqlen, the maximum number of bytes which will be read for any request.
- New option in ServerConfig: LogIP, whether to log Client IPs on connect or not.
- Improvements in reliability and correctness of network handling.
- Client now returns nil and an error when it receives an error response from the Server side.
- Better consistency in messaging; efficiency improvements in Msg generation.
- Long-form docs are temporarily gutted for rebuild next release.
- Version jump: unified versions and added 1
- Use qsplit.LocationsOnce for faster separation of request command and args
- Name change: asock -> petrel
- asock.Asock is now petrel.Handler
- Asock.AddHandler is now Handler.AddFunc
- Valid settings for Handler.AddFunc's second argument (mode) have changed from "split"/"nosplit" to "args"/"blob". This change means that the setting now describes its use-case instead of its implementation.
- Null request and unknown command messages no longer return a list of known handlers. This exposed internal state. Users should implement their own 'help' type handler.
- Docs rewrite.
- Oneshot connection mode is gone. It was a bad idea, torturously implemented.
- Constructors now take -Config instead of Config.
- Improvements to timeout handling (func call eliminated; no more local var creation and time.Duration casting on every network operation).
- Small networking improvements
- EOM is gone. All messages are now sent prefixed with their length in bytes as a 4 byte header.
- pclient now used where possible for petrel test cases
- Moved example client to the pclient package
- Example server now includes a handler which returns an error.
- Test coverage brought back up from rapid 0.16/0.17 dev cycles.
- Documentation improvements
- Breaking changes
- Dispatch is no longer a public type. As a result, it no longer appears in constructor calls and does not have to be instantiated by the user.
- DispatchFunc is no longer a public type. Dispatch functions are now added to Asock instances by calling the AddHandler() method.
- Docs are all kinds of wrong right now. 0.18 will fix this.
- petrel/client moved to own package, pclient
- Breaking changes
- Config.TLSConfig no longer exists. It is once again an argument of petrel.NewTLS().
- petrel.NewUnix() has a new argument, which is the Unix permissions to set on the socket.
- Aclient constructors now take a single argument, a Config struct, as the Asock constructors do.
- client.Config has a new
EOM
field, which behaves identically to the petrel.Config field of the same name, described below. - The Msg generated by a.Quit being invoked (code 199) is now sent regardless of Msglvl setting.
- There is a new Msg, code 401, for a null request.
- Additions and other changes
- The petrel.Config struct has a new field,
EOM
, which sets the end-of-message marker (defaults to "\n\n"). - Network handling is now more correct and robust.
- Test suite speedups (across 0.16 and 0.15)
- The petrel.Config struct has a new field,
- Breaking changes
- The
Config
struct has two new fields:- Config.Buffer specifies the size of the buffer on the Asock.Msgr channel (defaults to 32).
- Config.TLSConfig is the *tls.Config instance which is needed to set up a TLS connection. This was formerly an argument of petrel.NewTLS().
- The
Timeout
field in theConfig
struct is now treated as milliseconds instead of seconds. - client constructors have a new argument,
timeout
, which sets the number of milliseconds before read/write operations timeout.
- The
- Additions and other changes
- client has a new method, Read()
- A special-casing of Config.Timeout for test purposes has been removed from the production petrel code.
- Read buffer in petrel and client now defaults to 128 bytes (up from 64).
- Documentation improvements
- TLS support added via the petrel & client NewTLS() methods.
petrel/client
package added- Documentation improvements
- Msg now implements the error interface, so it will autostringify when passed to fmt.Println, log.Print, log.Fatal, etc.
- Msg.Conn and Msg.Req are now uint (were int)
- Documentation improvements
- Breaking changes
- Argmode functionality is now per Dispatch function instead of per petrel instance.
- As a result, the signature of Dispatch has changed to 'map[string]*DispatchFunc', where DispatchFunc is a new type which holds information about Dispatch functions.
- Breaking changes
- New Config field, Argmode. This controls how arguments to Dispatch functions will be handled.
- Breaking changes
- Dispatch functions are now of type 'func([][]byte) ([]byte error)' Formerly the argument was '[]string'.
- Breaking changes
- Constructors now take a configuration struct rather than a long list of parameters
- Unix socket names are no longer semiautomagic; sockets are now created exactly where Config.sockname says.
- Breaking changes
- Package name change!
- New() is now NewUnix()
- Additions and other changes
- Added TCP support - NewTCP()
-
Breaking changes
- New() now has a 4th argument, messaging level, which controls which messages will be sent to a.Msgr
-
Additions and other changes
- Msg type is now far more robust, enabling better logging. Concommitantly, Msg.Txt is now generally more terse, since more information is elsewhere
- All Msgs now have a numeric Code field, which accurately identifies what sort of message it is
- A Msg is now generated when a response is sent to a client
- Improved test coverage
-
Bugfixes
- A response is no longer sent when the request generates an error
- Connection closures due to timeout now generate a Msg indicating server-side closure instead of client-side closure
- Changes to match new qsplit API
- Breaking changes
- Socket names are no longer automagic. They are now an argument to New()
- Negative timeout values now set a connection deadline in addition to creating a one-shot connection (e.g. -5 creates a one-shot conn with a 5 second deadline)
- All dispatches now generate a Msg, not just those which fail
- Additions and other changes
- sockAccept() and connHandler() are now part of Asock's methodset, eliminating several arguments to each
- There is now a (preëmptive) canonical import path
- Documentation improvements
- Now 'go vet' and golint approved
- Public release
- Imported code from everydayd