Code Monkey home page Code Monkey logo

typhon's Introduction

Typhon ๐Ÿฒ

Build Status GoDoc

Typhon is a wrapper around Go's net/http library that we use at Monzo to build RPC servers and clients in our microservices platform.

It provides a number of conveniences and tries to promote safety wherever possible. Here's a short list of interesting features in Typhon:

  • No need to close body.Close() in clients
    Forgetting to body.Close() in a client when the body has been dealt with is a common source of resource leaks in Go programs in our experience. Typhon ensures that โ€“ unless you're doing something really weird with the body โ€“ it will be closed automatically.

  • Middleware "filters"
    Filters are decorators around Services; in Typhon servers and clients share common functionality by composing it functionally.

  • Body encoding and decoding
    Marshalling and unmarshalling request bodies to structs is such a common operation that our Request and Response objects support them directly. If the operations fail, the errors are propagated automatically since that's nearly always what a server will want.

  • Propagation of cancellation
    When a server has done handling a request, the request's context is automatically cancelled, and these cancellations are propagated through the distributed call stack. This lets downstream servers conserve work producing responses that are no longer needed.

  • Error propagation
    Responses have an inbuilt Error attribute, and serialisation/deserialisation of these errors into HTTP errors is taken care of automatically. We recommend using this in conjunction with monzo/terrors.

  • Full HTTP/1.1 and HTTP/2.0 support
    Applications implemented using Typhon can communicate over HTTP/1.1 or HTTP/2.0. Typhon has support for full duplex communication under HTTP/2.0, and h2c (HTTP/2.0 over TCP, ie. without TLS) is also supported if required.

typhon's People

Contributors

clarkecdc avatar cstorey-monzo avatar dancannon avatar danielchatfield avatar domwong avatar dovys avatar dvrkps avatar eddshaw avatar intunderflow avatar jace-ys avatar jackkleeman avatar joechrisellis avatar jonastemplestein avatar mattheath avatar mellievt avatar milesbxf avatar obeattie avatar priyeshpatel avatar rdingwall avatar robinjmurphy avatar rohanpadmanabhan avatar shawnps avatar suhailpatel avatar thomaspurchas avatar thschroeter avatar tomblomfield avatar vincepri avatar williamray avatar willsewell avatar willyham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typhon's Issues

is there any documentation that i can read to use typhon

I am building a small app in a micro-services architecture, but i am still new to Go. I just saw the presentation by Mat Heath, and I was wondering if there is any documentation that i could rely on to build my services with Go. I have already wrote 3 services with Gin framework, but they still don't talk to each others, and so i thought typhon maybe a good option to build on top if it.

Still being used in production?

Hello, i was wondering if Typhon is still being used in production at Monzo or if you switched to a different RPC framework for building your services. if your still using Typhon what are you using as an alternative to Mercury?

Ambiguous routes cause path / method lookup to fail

This has been raised upstream at labstack/echo#1225 .
If we have handlers for GET /foo/:bar and DELETE /foo/quux and we then request GET /foo/quux, then because of the preference for matching fixed path elements, the lookup strategy will:

  • Find the matching route /foo/quux
  • Check for a GET handler, and not find one
  • Fail with a not found error.

We should be able to backtrack, and then check /foo/:bar, but the current implementation doesn't make provision for backtracking.

Panic on URL without schema

When an URL is provided without a schema or a completely invalid URL an error should be returned.
The current behavior is a panic from dynamicRountTripper.RoundTrip()

Example URL's

  • 127.0.0.1:80/test
  • notaurl^^

how to remove stack from responce

iam getting responce like this

{"code":"bad_request.foo","message":"Invalid or Inactive webform","stack":[{"filename":"/home/anirudh/mailercloud_form_tracker/main.go","line":17,"method":"main.testerror"},{"filename":"github.com/monzo/[email protected]/router.go","line":127,"method":"typhon.Router.Serve.func1"},{"filename":"github.com/monzo/[email protected]/errors.go","line":65,"method":"typhon.ErrorFilter"},{"filename":"github.com/monzo/[email protected]/service.go","line":10,"method":"typhon.Service.Filter.func1"},{"filename":"github.com/monzo/[email protected]/server.go","line":82,"method":"typhon.Serve.func1"},{"filename":"github.com/monzo/[email protected]/service.go","line":10,"method":"typhon.Service.Filter.func1"},{"filename":"github.com/monzo/[email protected]/http.go","line":95,"method":"typhon.HttpHandler.func1"},{"filename":"/usr/lib/golang/src/net/http/server.go","line":2042,"method":"http.HandlerFunc.ServeHTTP"},{"filename":"/usr/lib/golang/src/net/http/server.go","line":2843,"method":"http.serverHandler.ServeHTTP"},{"filename":"/usr/lib/golang/src/net/http/server.go","line":1925,"method":"http.(*conn).serve"},{"filename":"/usr/lib/golang/src/runtime/asm_amd64.s","line":1374,"method":"runtime.goexit"}],"retryable":{}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.