Go implementation of a multiplexing and framing protocol for RPC calls
Clone or download
Latest commit 62ffbc3 Nov 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmark relay: Export TCP connection's RemoteAddr with calls (#719) Oct 2, 2018
crossdock thrift: Return error if we didn't decode a known exception (#566) Jan 19, 2017
examples thrift: Return error if we didn't decode a known exception (#566) Jan 19, 2017
guide Update tchannel/golang imports to tchannel-go Oct 3, 2015
http Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
hyperbahn Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
internal/argreader Ensure reader is empty before calling Close (#564) Jan 19, 2017
json Small test cleanups (#551) Dec 21, 2016
peers Fix flaky TestHRWScorerIntegration due to error logs (#593) Feb 24, 2017
pprof Fix import ordering Jun 17, 2016
raw Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
relay relay: Add IsOutbound to relay.Conn (#720) Nov 12, 2018
scripts Delete unused changelog_halp script Feb 1, 2018
stats stats: Fix flaky test TestTallyIntegration (#694) Apr 2, 2018
testutils Add a way to signal when a Channel has closed (#718) Oct 4, 2018
thrift thrift: Support health check type in Health endpoint (#696) Jun 12, 2018
tnet Wrap a net.Listener for better Close semantics Jan 5, 2016
tos Set DiffServ (QoS) bit on Outbound Connections (#516) Mar 22, 2017
trace Restore trace package (#486) Aug 17, 2016
trand Move threadsafe rand.Rand to a package May 4, 2016
typed Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
.gitignore ping: Don't close connection on errors (#655) Sep 28, 2017
.travis.yml Support go1.10, and remove go1.7 (#713) Aug 9, 2018
CHANGELOG.md Update CHANGELOG and version in prep for 1.12.0 release (#721) Nov 14, 2018
CODE_OF_CONDUCT.md Add a code of conduct (#711) Jul 23, 2018
CONTRIBUTING.md Version 1.3.0 Preparation (#576) Feb 2, 2017
LICENSE.md Add a separate license file Jan 8, 2016
Makefile Support go1.10, and remove go1.7 (#713) Aug 9, 2018
README.md Enable coveralls.io support Jan 10, 2016
RELEASE.md Update RELEASE document to mention "-b" Feb 1, 2018
all_channels.go Log Info level logs on channel creation (#622) Apr 19, 2017
all_channels_test.go introspection: Only include other channels if requested (#474) Aug 5, 2016
arguments.go Ensure reader is empty before calling Close (#564) Jan 19, 2017
arguments_test.go Ensure reader is empty before calling Close (#564) Jan 19, 2017
calloptions.go Support routing key transport header and call option (#496) Sep 15, 2016
calloptions_test.go Support routing key transport header and call option (#496) Sep 15, 2016
channel.go Add a way to signal when a Channel has closed (#718) Oct 4, 2018
channel_test.go log: Use serviceName key for channel logs, DRY up logger creation (#662) Nov 1, 2017
channel_utils_test.go Simplify testutils.NewServer and NewChannel Nov 7, 2015
channelstate_string.go Add ChannelState to progress the state of a channel as it closes. Aug 3, 2015
checksum.go Pool checksum objects Jan 5, 2016
close_test.go Fix flaky TestCloseSemantics, use separate context per call (#592) Feb 24, 2017
codecov.yml Add codecov.yml file with ignores for _string.go (#654) Sep 27, 2017
conn_leak_test.go Fix connection leak caused by references from peer (#644) Aug 8, 2017
connection.go relay: Add IsOutbound to relay.Conn (#720) Nov 12, 2018
connection_bench_test.go Fix import ordering Jun 17, 2016
connection_direction.go Refactor add*Connection to be shared May 18, 2016
connection_test.go Sending a large error should mention that we're out of space (#716) Sep 9, 2018
connectionstate_string.go Only create Connection object for active TChannel connections (#587) Feb 24, 2017
context.go Expose LocalPeer on {Inbound,Outbound}Call (#537) Dec 21, 2016
context_builder.go context: If parent has deadline, and timeout is 0, use WithCancel (#691) Apr 2, 2018
context_header.go Add tchannel.WithoutHeaders (#637) Aug 3, 2017
context_internal_test.go Add tchannel.WithoutHeaders (#637) Aug 3, 2017
context_test.go context: If parent has deadline, and timeout is 0, use WithCancel (#691) Apr 2, 2018
deps_test.go glide.yaml improvements: use testImports, only pin versions (#649) Sep 26, 2017
dial_16.go Use net.DialContext on go1.7 when creating outbound connections (#541) Dec 21, 2016
dial_17.go Use net.DialContext on go1.7 when creating outbound connections (#541) Dec 21, 2016
dial_17_test.go Use net.DialContext on go1.7 when creating outbound connections (#541) Dec 21, 2016
doc.go Add tchannel documentation Oct 5, 2015
errors.go Only create Connection object for active TChannel connections (#587) Feb 24, 2017
errors_test.go relay: Avoid allocations on errors from relay Dec 21, 2016
fragmentation_test.go Fix import ordering Jun 17, 2016
fragmenting_reader.go Clarify error messages in for fragmenting reader errors (#567) Jan 19, 2017
fragmenting_writer.go Move ArgWriter interface into arguments.go Jan 13, 2016
frame.go Defer frame allocation in readFrames till we read a header (#658) Oct 31, 2017
frame_pool.go Enable SyncFramePool by default Nov 12, 2015
frame_pool_b_test.go Remove atomic package and use uber-go/atomic Jun 3, 2016
frame_pool_test.go Fix import ordering Jun 17, 2016
frame_test.go Defer frame allocation in readFrames till we read a header (#658) Oct 31, 2017
frame_utils_test.go Add ProtectMemFramePool which ensures frames aren't reused after Release Jun 22, 2016
glide.lock stats: Add tally reporter to emit tagged metrics (#676) Jan 31, 2018
glide.yaml stats: Add tally reporter to emit tagged metrics (#676) Jan 31, 2018
handlers.go SubChannel.SetHandler: override SubChannel Handlers Mar 1, 2016
handlers_test.go SubChannel.SetHandler: override SubChannel Handlers Mar 1, 2016
health.go Fix flaky TestHealthCheckStopBeforeStart (#660) Nov 1, 2017
health_ext_test.go testutils: Move out fake ticker Nov 29, 2017
health_test.go Add periodic health checks to TChannel (#318) Sep 29, 2017
idle_sweep.go relay: Ensure idle sweeper also considers relay calls (#714) Aug 9, 2018
idle_sweep_test.go relay: Ensure idle sweeper also considers relay calls (#714) Aug 9, 2018
inbound.go Allow blackholing requests (#681) Mar 23, 2018
inbound_test.go Allow blackholing requests (#681) Mar 23, 2018
incoming_test.go Fix import ordering Jun 17, 2016
init_test.go Consistent error logging on init handshake errors (#602) Mar 1, 2017
introspection.go introspection: Include channel state in output (#692) Apr 2, 2018
introspection_test.go introspection: Add inactive connections to output (#686) Mar 23, 2018
largereq_test.go Fix import ordering Jun 17, 2016
localip.go ListenIP: Reduce preference for locally administered MAC addresses. (#… Jan 19, 2017
localip_test.go ListenIP: Reduce preference for locally administered MAC addresses. (#… Jan 19, 2017
logger.go nullLogger should store all fields Feb 3, 2016
logger_test.go Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
messages.go Support routing key transport header and call option (#496) Sep 15, 2016
messages_test.go Fix import ordering Jun 17, 2016
messagetype_string.go go: Ping/Pong implementation. Jun 17, 2015
mex.go Allow blackholing requests (#681) Mar 23, 2018
mex_utils_test.go Introduce testutils.TestServer Mar 29, 2016
outbound.go Only create Connection object for active TChannel connections (#587) Feb 24, 2017
peer.go Fix connection leak caused by references from peer (#644) Aug 8, 2017
peer_bench_test.go Fix import ordering Jun 17, 2016
peer_heap.go Move threadsafe rand.Rand to a package May 4, 2016
peer_heap_test.go Update tests to avoid using unexported types Jan 15, 2016
peer_internal_test.go Treat hostPorts ending in ":0" in the init headers as ephemeral (#513) Dec 21, 2016
peer_strategies.go Isolated subchannels should not prefer incoming Dec 21, 2015
peer_test.go Added a peer.GetNew() to only return previously unselected peers. (#607) Mar 13, 2017
preinit_connection.go Use string version for all addresses (#669) Nov 22, 2017
relay.go relay: Add IsOutbound to relay.Conn (#720) Nov 12, 2018
relay_api.go relay: Export TCP connection's RemoteAddr with calls (#719) Oct 2, 2018
relay_benchmark_test.go Fix assertion that warmup succeeded Jun 21, 2016
relay_internal_test.go relay: Verify no use-after-free in timer pool (#690) Apr 2, 2018
relay_messages.go Clamp relay timeouts to a configurable max (#530) Dec 21, 2016
relay_messages_benchmark_test.go relay: Use []byte instead of string for Caller/Service/Method Jun 19, 2016
relay_messages_test.go Clamp relay timeouts to a configurable max (#530) Dec 21, 2016
relay_test.go relay: Add IsOutbound to relay.Conn (#720) Nov 12, 2018
relay_timer_pool.go relay: Verify no use-after-free in timer pool (#690) Apr 2, 2018
reqres.go Refactor connection options propagation (#568) Jan 19, 2017
reqresreaderstate_string.go Add _string generated files (and stop ignoring them) Jun 16, 2015
reqreswriterstate_string.go Add _string generated files (and stop ignoring them) Jun 16, 2015
retry.go Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
retry_request_test.go Fix import ordering Jun 17, 2016
retry_test.go Small test cleanups (#551) Dec 21, 2016
retryon_string.go Add RetryIdempotent option Nov 10, 2015
root_peer_list.go Add hook for peer connection status changes (#624) May 31, 2017
stats.go Fix copyright headers in *.go files. Aug 21, 2015
stats_test.go Make stats_test less sensitive to the number of timeNow calls (#668) Nov 15, 2017
stats_utils_test.go Fix "copying lock" go vet Feb 25, 2016
stream_test.go Fix flaky test TestResponseClosedBeforeRequest (#438) Jul 15, 2016
stress_flag_test.go Fix copyright headers in *.go files. Aug 21, 2015
subchannel.go Update the peer scores when SetStrategy is called (#583) Feb 15, 2017
subchannel_test.go Override inbound request handler (#590) Feb 24, 2017
systemerrcode_string.go Generate string methods for SystemErrCode Nov 3, 2015
tchannel_test.go Ensure that all created channels are closed Apr 21, 2016
tracing.go Ensure outbound tracing headers take precedence (#683) Feb 23, 2018
tracing_internal_test.go Only create Connection object for active TChannel connections (#587) Feb 24, 2017
tracing_keys.go Integrate OpenTracing (#426) Aug 5, 2016
tracing_test.go Ensure outbound tracing headers take precedence (#683) Feb 23, 2018
utils_for_test.go Add periodic health checks to TChannel (#318) Sep 29, 2017
verify_utils_test.go introspection: Include channel state in output (#692) Apr 2, 2018
version.go Back to development Nov 14, 2018

README.md

TChannel GoDoc Build Status Coverage Status

TChannel is a multiplexing and framing protocol for RPC calls. tchannel-go is a Go implementation of the protocol, including client libraries for Hyperbahn.

If you'd like to start by writing a small Thrift and TChannel service, check out this guide. For a less opinionated setup, see the contribution guidelines.

Overview

TChannel is a network protocol that supports:

  • A request/response model,
  • Multiplexing multiple requests across the same TCP socket,
  • Out-of-order responses,
  • Streaming requests and responses,
  • Checksummed frames,
  • Transport of arbitrary payloads,
  • Easy implementation in many languages, and
  • Redis-like performance.

This protocol is intended to run on datacenter networks for inter-process communication.

Protocol

TChannel frames have a fixed-length header and 3 variable-length fields. The underlying protocol does not assign meaning to these fields, but the included client/server implementation uses the first field to represent a unique endpoint or function name in an RPC model. The next two fields can be used for arbitrary data. Some suggested way to use the 3 fields are:

  • URI path + HTTP method and headers as JSON + body, or
  • Function name + headers + thrift/protobuf.

Note, however, that the only encoding supported by TChannel is UTF-8. If you want JSON, you'll need to stringify and parse outside of TChannel.

This design supports efficient routing and forwarding: routers need to parse the first or second field, but can forward the third field without parsing.

There is no notion of client and server in this system. Every TChannel instance is capable of making and receiving requests, and thus requires a unique port on which to listen. This requirement may change in the future.

See the protocol specification for more details.

Examples

  • ping: A simple ping/pong example using raw TChannel.
  • thrift: A Thrift server/client example.
  • keyvalue: A keyvalue Thrift service with separate server and client binaries.

This project is released under the [MIT License](LICENSE.md).