Skip to content

Commit

Permalink
Add modules support and bump version up to 3.0.0. (#292)
Browse files Browse the repository at this point in the history
* Add modules support and bump version up to 3.0.0.
  • Loading branch information
hueich committed Jul 9, 2019
1 parent 5acf86f commit b99070a
Show file tree
Hide file tree
Showing 126 changed files with 365 additions and 347 deletions.
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -14,9 +14,17 @@ Martian is a great tool to use if you want to:
By taking advantage of Go cross-compilation, Martian can be deployed
anywhere that Go can target.

## Latest Version

v3.0.0

## Requirements

Go 1.9
Go 1.11

## Go Modules Support

Martian Proxy added support for Go modules since v3.0.0. If you use a Go version that does not support modules, this will break you. The latest version without Go modules support was tagged v2.1.0.

## Getting Started

Expand Down
4 changes: 2 additions & 2 deletions api/forwarder.go
Expand Up @@ -20,8 +20,8 @@ import (
"fmt"
"net/http"

"github.com/google/martian"
"github.com/google/martian/log"
"github.com/google/martian/v3"
"github.com/google/martian/v3/log"
)

// Forwarder is a request modifier that routes the request to the API server and
Expand Down
2 changes: 1 addition & 1 deletion api/forwarder_test.go
Expand Up @@ -18,7 +18,7 @@ import (
"net/http"
"testing"

"github.com/google/martian"
"github.com/google/martian/v3"
)

func TestApiForwarder(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion auth/auth_filter.go
Expand Up @@ -21,7 +21,7 @@ import (
"net/http"
"sync"

"github.com/google/martian"
"github.com/google/martian/v3"
)

// Filter filters RequestModifiers and ResponseModifiers by auth ID.
Expand Down
6 changes: 3 additions & 3 deletions auth/auth_filter_test.go
Expand Up @@ -18,9 +18,9 @@ import (
"net/http"
"testing"

"github.com/google/martian"
"github.com/google/martian/martiantest"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3"
"github.com/google/martian/v3/martiantest"
"github.com/google/martian/v3/proxyutil"
)

func TestFilter(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion auth/context.go
Expand Up @@ -17,7 +17,7 @@ package auth
import (
"sync"

"github.com/google/martian"
"github.com/google/martian/v3"
)

const key = "auth.Context"
Expand Down
4 changes: 2 additions & 2 deletions body/body_modifier.go
Expand Up @@ -28,8 +28,8 @@ import (
"strconv"
"strings"

"github.com/google/martian/log"
"github.com/google/martian/parse"
"github.com/google/martian/v3/log"
"github.com/google/martian/v3/parse"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions body/body_modifier_test.go
Expand Up @@ -25,9 +25,9 @@ import (
"strings"
"testing"

"github.com/google/martian/messageview"
"github.com/google/martian/parse"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3/messageview"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/proxyutil"
)

func TestBodyModifier(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/marbl/viewer.go
Expand Up @@ -30,7 +30,7 @@ import (
"log"
"os"

"github.com/google/martian/marbl"
"github.com/google/martian/v3/marbl"
)

var (
Expand Down
54 changes: 27 additions & 27 deletions cmd/proxy/main.go
Expand Up @@ -205,33 +205,33 @@ import (
"strings"
"time"

"github.com/google/martian"
mapi "github.com/google/martian/api"
"github.com/google/martian/cors"
"github.com/google/martian/fifo"
"github.com/google/martian/har"
"github.com/google/martian/httpspec"
"github.com/google/martian/marbl"
"github.com/google/martian/martianhttp"
"github.com/google/martian/martianlog"
"github.com/google/martian/mitm"
"github.com/google/martian/servemux"
"github.com/google/martian/trafficshape"
"github.com/google/martian/verify"

_ "github.com/google/martian/body"
_ "github.com/google/martian/cookie"
_ "github.com/google/martian/failure"
_ "github.com/google/martian/martianurl"
_ "github.com/google/martian/method"
_ "github.com/google/martian/pingback"
_ "github.com/google/martian/port"
_ "github.com/google/martian/priority"
_ "github.com/google/martian/querystring"
_ "github.com/google/martian/skip"
_ "github.com/google/martian/stash"
_ "github.com/google/martian/static"
_ "github.com/google/martian/status"
"github.com/google/martian/v3"
mapi "github.com/google/martian/v3/api"
"github.com/google/martian/v3/cors"
"github.com/google/martian/v3/fifo"
"github.com/google/martian/v3/har"
"github.com/google/martian/v3/httpspec"
"github.com/google/martian/v3/marbl"
"github.com/google/martian/v3/martianhttp"
"github.com/google/martian/v3/martianlog"
"github.com/google/martian/v3/mitm"
"github.com/google/martian/v3/servemux"
"github.com/google/martian/v3/trafficshape"
"github.com/google/martian/v3/verify"

_ "github.com/google/martian/v3/body"
_ "github.com/google/martian/v3/cookie"
_ "github.com/google/martian/v3/failure"
_ "github.com/google/martian/v3/martianurl"
_ "github.com/google/martian/v3/method"
_ "github.com/google/martian/v3/pingback"
_ "github.com/google/martian/v3/port"
_ "github.com/google/martian/v3/priority"
_ "github.com/google/martian/v3/querystring"
_ "github.com/google/martian/v3/skip"
_ "github.com/google/martian/v3/stash"
_ "github.com/google/martian/v3/static"
_ "github.com/google/martian/v3/status"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/proxy/main_test.go
Expand Up @@ -30,7 +30,7 @@ import (
"testing"
"time"

"github.com/google/martian/mitm"
"github.com/google/martian/v3/mitm"
)

func waitForProxy(t *testing.T, c *http.Client, apiURL string) {
Expand Down
8 changes: 4 additions & 4 deletions cookie/cookie_filter.go
Expand Up @@ -18,10 +18,10 @@ import (
"encoding/json"
"net/http"

"github.com/google/martian"
"github.com/google/martian/filter"
"github.com/google/martian/log"
"github.com/google/martian/parse"
"github.com/google/martian/v3"
"github.com/google/martian/v3/filter"
"github.com/google/martian/v3/log"
"github.com/google/martian/v3/parse"
)

var noop = martian.Noop("cookie.Filter")
Expand Down
10 changes: 5 additions & 5 deletions cookie/cookie_filter_test.go
Expand Up @@ -18,11 +18,11 @@ import (
"net/http"
"testing"

"github.com/google/martian/filter"
_ "github.com/google/martian/header"
"github.com/google/martian/martiantest"
"github.com/google/martian/parse"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3/filter"
_ "github.com/google/martian/v3/header"
"github.com/google/martian/v3/martiantest"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/proxyutil"
)

func TestFilterFromJSON(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cookie/cookie_matcher.go
Expand Up @@ -17,7 +17,7 @@ package cookie
import (
"net/http"

"github.com/google/martian/log"
"github.com/google/martian/v3/log"
)

// Matcher is a conditonal evalutor of request or
Expand Down
6 changes: 3 additions & 3 deletions cookie/cookie_modifier.go
Expand Up @@ -20,9 +20,9 @@ import (
"net/http"
"time"

"github.com/google/martian"
"github.com/google/martian/log"
"github.com/google/martian/parse"
"github.com/google/martian/v3"
"github.com/google/martian/v3/log"
"github.com/google/martian/v3/parse"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions cookie/cookie_modifier_test.go
Expand Up @@ -18,8 +18,8 @@ import (
"net/http"
"testing"

"github.com/google/martian/parse"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/proxyutil"
)

func TestCookieModifier(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions failure/failure_verifier.go
Expand Up @@ -23,9 +23,9 @@ import (
"fmt"
"net/http"

"github.com/google/martian"
"github.com/google/martian/parse"
"github.com/google/martian/verify"
"github.com/google/martian/v3"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/verify"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions failure/failure_verifier_test.go
Expand Up @@ -18,9 +18,9 @@ import (
"net/http"
"testing"

"github.com/google/martian"
"github.com/google/martian/parse"
"github.com/google/martian/verify"
"github.com/google/martian/v3"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/verify"
)

func TestVerifyRequestFails(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions fifo/fifo_group.go
Expand Up @@ -25,10 +25,10 @@ import (
"net/http"
"sync"

"github.com/google/martian"
"github.com/google/martian/log"
"github.com/google/martian/parse"
"github.com/google/martian/verify"
"github.com/google/martian/v3"
"github.com/google/martian/v3/log"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/verify"
)

// Group is a martian.RequestResponseModifier that maintains lists of
Expand Down
12 changes: 6 additions & 6 deletions fifo/fifo_group_test.go
Expand Up @@ -21,13 +21,13 @@ import (
"reflect"
"testing"

"github.com/google/martian"
"github.com/google/martian/martiantest"
"github.com/google/martian/parse"
"github.com/google/martian/proxyutil"
"github.com/google/martian/verify"
"github.com/google/martian/v3"
"github.com/google/martian/v3/martiantest"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/proxyutil"
"github.com/google/martian/v3/verify"

_ "github.com/google/martian/header"
_ "github.com/google/martian/v3/header"
)

func TestGroupFromJSON(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions filter/filter.go
Expand Up @@ -20,9 +20,9 @@ import (
"fmt"
"net/http"

"github.com/google/martian"
"github.com/google/martian/log"
"github.com/google/martian/verify"
"github.com/google/martian/v3"
"github.com/google/martian/v3/log"
"github.com/google/martian/v3/verify"
)

var noop = martian.Noop("Filter")
Expand Down
6 changes: 3 additions & 3 deletions filter/filter_test.go
Expand Up @@ -19,9 +19,9 @@ import (
"net/http"
"testing"

"github.com/google/martian/martiantest"
"github.com/google/martian/proxyutil"
"github.com/google/martian/verify"
"github.com/google/martian/v3/martiantest"
"github.com/google/martian/v3/proxyutil"
"github.com/google/martian/v3/verify"
)

func TestRequestWhenTrueCondition(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions go.mod
@@ -0,0 +1,5 @@
module github.com/google/martian/v3

go 1.11

require golang.org/x/net v0.0.0-20190628185345-da137c7871d7
5 changes: 5 additions & 0 deletions go.sum
@@ -0,0 +1,5 @@
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
8 changes: 4 additions & 4 deletions har/har.go
Expand Up @@ -33,10 +33,10 @@ import (
"time"
"unicode/utf8"

"github.com/google/martian"
"github.com/google/martian/log"
"github.com/google/martian/messageview"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3"
"github.com/google/martian/v3/log"
"github.com/google/martian/v3/messageview"
"github.com/google/martian/v3/proxyutil"
)

// Logger maintains request and response log entries.
Expand Down
2 changes: 1 addition & 1 deletion har/har_handlers.go
Expand Up @@ -20,7 +20,7 @@ import (
"net/url"
"strconv"

"github.com/google/martian/log"
"github.com/google/martian/v3/log"
)

type exportHandler struct {
Expand Down
4 changes: 2 additions & 2 deletions har/har_handlers_test.go
Expand Up @@ -20,8 +20,8 @@ import (
"net/http/httptest"
"testing"

"github.com/google/martian"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3"
"github.com/google/martian/v3/proxyutil"
)

func TestExportHandlerServeHTTP(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions har/har_test.go
Expand Up @@ -24,8 +24,8 @@ import (
"testing"
"time"

"github.com/google/martian"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3"
"github.com/google/martian/v3/proxyutil"
)

func TestModifyRequest(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions header/copy_modifier.go
Expand Up @@ -18,10 +18,10 @@ import (
"encoding/json"
"net/http"

"github.com/google/martian"
"github.com/google/martian/log"
"github.com/google/martian/parse"
"github.com/google/martian/proxyutil"
"github.com/google/martian/v3"
"github.com/google/martian/v3/log"
"github.com/google/martian/v3/parse"
"github.com/google/martian/v3/proxyutil"
)

func init() {
Expand Down

0 comments on commit b99070a

Please sign in to comment.