Skip to content

Commit

Permalink
Merge pull request #8 from corazawaf/clean
Browse files Browse the repository at this point in the history
Clean code
  • Loading branch information
jptosso authored Apr 4, 2022
2 parents ffa1472 + c62b068 commit b885d71
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ before:
- cp caddy/main.go caddy-build/main.go
- cp go.mod caddy-build/go.mod
# BSD systems require an empty string before the expression
- sed -i '' 's|github.com/jptosso/coraza-caddy|coraza|g' caddy-build/go.mod
- sed -i '' 's|github.com/corazawaf/coraza-caddy|coraza|g' caddy-build/go.mod
# GoReleaser doesn't seem to offer {{.Tag}} at this stage, so we have to embed it into the env
# so we run: TAG=$(git describe --abbrev=0) goreleaser release --rm-dist --skip-publish --skip-validate
- go mod edit -require=github.com/jptosso/coraza-caddy@4bcd691 caddy-build/go.mod
- go mod edit -require=github.com/corazawaf/coraza-caddy@4bcd691 caddy-build/go.mod
#{{.Env.TAG}} ./caddy-build/go.mod
# as of Go 1.16, `go` commands no longer automatically change go.{mod,sum}. We now have to explicitly
# run `go mod tidy`. The `/bin/sh -c '...'` is because goreleaser can't find cd in PATH without shell invocation.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Coraza WAF Caddy Module

[![Tests](https://github.com/jptosso/coraza-caddy/actions/workflows/tests.yml/badge.svg)](https://github.com/jptosso/coraza-caddy/actions/workflows/tests.yml)
<a href="https://pkg.go.dev/github.com/jptosso/coraza-caddy" target="_blank"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"></a>
[![Tests](https://github.com/corazawaf/coraza-caddy/actions/workflows/tests.yml/badge.svg)](https://github.com/corazawaf/coraza-caddy/actions/workflows/tests.yml)
<a href="https://pkg.go.dev/github.com/corazawaf/coraza-caddy" target="_blank"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"></a>
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)

Coraza Caddy Module a WAF for your applications using FastCGI or reverse proxy.
Expand Down Expand Up @@ -52,15 +52,15 @@ http://127.0.0.1:8080 {
Run:

```
xcaddy build --with github.com/jptosso/coraza-caddy
xcaddy build --with github.com/corazawaf/coraza-caddy
```

## Testing

You may run the test suite by executing:

```
$ git clone https://github.com/jptosso/coraza-caddy
$ git clone https://github.com/corazawaf/coraza-caddy
$ cd coraza-caddy
$ go test ./...`
```
Expand Down
19 changes: 17 additions & 2 deletions caddy/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
// Copyright 2022 The Corazawaf Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
caddycmd "github.com/caddyserver/caddy/v2/cmd"

_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/jptosso/coraza-caddy"
// You may uncomment the following lines to enable libinjection and pcre plugins
_ "github.com/corazawaf/coraza-caddy"

// You may uncomment the following lines to enable pcre plugins (if you need use crs rules)
// _ "github.com/jptosso/coraza-pcre"
)

Expand Down
14 changes: 14 additions & 0 deletions coraza.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2022 The Corazawaf Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package coraza

import (
Expand Down
14 changes: 14 additions & 0 deletions coraza_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2022 The Corazawaf Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package coraza

import (
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/jptosso/coraza-caddy
module github.com/corazawaf/coraza-caddy

go 1.16

Expand Down
14 changes: 14 additions & 0 deletions stream.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2022 The Corazawaf Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package coraza

import (
Expand Down

0 comments on commit b885d71

Please sign in to comment.