github.com/willmadison/cli@v6.40.1-0.20181018160101-29d5937903ff+incompatible/api/plugin/connection_wrapper.go (about)

     1  package plugin
     2  
     3  //go:generate counterfeiter . ConnectionWrapper
     4  
     5  // ConnectionWrapper can wrap a given connection allowing the wrapper to modify
     6  // all requests going in and out of the given connection.
     7  type ConnectionWrapper interface {
     8  	Connection
     9  	Wrap(innerconnection Connection) Connection
    10  }
    11  
    12  // WrapConnection wraps the current Client connection in the wrapper.
    13  func (client *Client) WrapConnection(wrapper ConnectionWrapper) {
    14  	client.connection = wrapper.Wrap(client.connection)
    15  }