github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/plugin/connection_wrapper.go (about)

     1  package plugin
     2  
     3  //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . 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  }