Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2

updates:
- package-ecosystem: gomod # See documentation for possible values
directory: "/" # Location of package manifests
Expand All @@ -13,7 +12,6 @@ updates:
- "rustatian"
assignees:
- "rustatian"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
54 changes: 36 additions & 18 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Linux

on: [push, pull_request]

jobs:
testing:
name: Tests [Go ${{ matrix.go }} OS ${{ matrix.os }}]
Expand All @@ -10,38 +8,58 @@ jobs:
strategy:
fail-fast: true
matrix:
go: [ stable ]
os: [ ubuntu-latest ]
go: [stable]
os: [ubuntu-latest]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Check out code
uses: actions/checkout@v3

- name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
uses: actions/cache@v3
uses: actions/checkout@v4
- name: Init Go modules Cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Install Go dependencies
run: go mod download

- name: Run golang tests on Linux with codecov
- name: Run golang tests on Linux with coverage
run: |
mkdir ./coverage-ci
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/frame.txt -covermode=atomic ./pkg/frame
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/pipe
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./pkg/rpc
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/socket
cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt

- uses: codecov/codecov-action@v3 # Docs: <https://github.com/codecov/codecov-action>
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/internal.txt -covermode=atomic ./internal
- name: Run fuzz tests
run: |
go test -tags=debug -fuzz=FuzzReadFrame -fuzztime=30s ./pkg/frame
go test -tags=debug -fuzz=FuzzReadOptions -fuzztime=30s ./pkg/frame
go test -tags=debug -fuzz=FuzzVerifyCRC -fuzztime=30s ./pkg/frame
go test -tags=debug -fuzz=FuzzFrameRoundTrip -fuzztime=30s ./pkg/frame
go test -tags=debug -fuzz=FuzzReceiveFrame -fuzztime=30s ./internal
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
with:
name: coverage
path: ./coverage-ci
codecov:
name: Upload coverage to Codecov
needs: [testing]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
name: coverage
- name: Merge coverage profiles
run: |
awk 'FNR==1 && /^mode:/ { if (!seen) { seen=1; print } next } { gsub(/github.com\/roadrunner-server\/goridge\/v4\//, ""); print }' *.txt > coverage.txt
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage-ci/summary.txt
files: ./coverage.txt
fail_ci_if_error: false
29 changes: 11 additions & 18 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: MacOS

on: [push, pull_request]

jobs:
build:
name: Tests [Go ${{ matrix.go }} OS ${{ matrix.os }}]
Expand All @@ -10,32 +8,27 @@ jobs:
strategy:
fail-fast: true
matrix:
go: [ stable ]
os: [ macos-latest ]
go: [stable]
os: [macos-latest]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Check out code
uses: actions/checkout@v3

- name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
uses: actions/cache@v3
uses: actions/checkout@v4
- name: Init Go modules Cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Install Go dependencies
run: go mod download

- name: Run golang tests on MacOS
run: |
mkdir ./coverage-ci
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/frame.txt -covermode=atomic ./pkg/frame
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/pipe
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./pkg/rpc
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/socket
cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt
go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/frame
go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/pipe
go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/rpc
go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/socket
go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./internal
10 changes: 5 additions & 5 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
os: [ windows-latest ]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
uses: actions/cache@v3
- name: Init Go modules Cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
Expand All @@ -31,10 +31,10 @@ jobs:
- name: Install Go dependencies
run: go mod download


- name: Run golang tests on Windows
run: |
go test -v -race -tags=debug ./pkg/frame
go test -v -race -tags=debug ./pkg/pipe
go test -v -race -tags=debug ./pkg/rpc
go test -v -race -tags=debug ./pkg/socket
go test -v -race -tags=debug ./internal
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ version: "2"
run:
modules-download-mode: readonly
allow-parallel-runners: true
output:
formats:
text:
path: stdout
linters:
default: none
enable:
Expand Down Expand Up @@ -63,6 +59,10 @@ linters:
- legacy
- std-error-handling
rules:
- linters:
- gosec
path: pkg/frame/frame.go
text: "G602|G115"
- linters:
- scopelint
path: pkg/frame/frame_test.go
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
.PHONY: test
test:
go test -v -race -cover -tags=debug ./internal
go test -v -race -cover -tags=debug ./pkg/frame
go test -v -race -cover -tags=debug ./pkg/pipe
go test -v -race -cover -tags=debug ./pkg/rpc
go test -v -race -cover -tags=debug ./pkg/socket

.PHONY: fuzz
fuzz:
go test -fuzz=FuzzReadFrame -fuzztime=10s ./pkg/frame
go test -fuzz=FuzzReadOptions -fuzztime=10s ./pkg/frame
go test -fuzz=FuzzVerifyCRC -fuzztime=10s ./pkg/frame
go test -fuzz=FuzzFrameRoundTrip -fuzztime=10s ./pkg/frame
go test -fuzz=FuzzReceiveFrame -fuzztime=10s ./internal
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
High-performance PHP-to-Golang IPC bridge
=================================================
[![GoDoc](https://godoc.org/github.com/roadrunner-server/goridge/v3?status.svg)](https://godoc.org/github.com/roadrunner-server/goridge/v3)
[![GoDoc](https://godoc.org/github.com/roadrunner-server/goridge/v4?status.svg)](https://godoc.org/github.com/roadrunner-server/goridge/v4)
![Linux](https://github.com/roadrunner-server/goridge/workflows/Linux/badge.svg)
![macOS](https://github.com/roadrunner-server/goridge/workflows/MacOS/badge.svg)
![Windows](https://github.com/roadrunner-server/goridge/workflows/Windows/badge.svg)
Expand Down Expand Up @@ -39,7 +39,7 @@ Installation
------------

```go
GO111MODULE=on go get github.com/roadrunner-server/goridge/v3
GO111MODULE=on go get github.com/roadrunner-server/goridge/v4
```

### Sample of usage
Expand All @@ -51,7 +51,7 @@ import (
"net"
"net/rpc"

goridgeRpc "github.com/roadrunner-server/goridge/v3/pkg/rpc"
goridgeRpc "github.com/roadrunner-server/goridge/v4/pkg/rpc"
)

type App struct{}
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/rpc"
"time"

goridgeRpc "github.com/roadrunner-server/goridge/v3/pkg/rpc"
"github.com/roadrunner-server/goridge/v3/tests"
goridgeRpc "github.com/roadrunner-server/goridge/v4/pkg/rpc"
"github.com/roadrunner-server/goridge/v4/tests"
)

func main() {
Expand Down
12 changes: 4 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
module github.com/roadrunner-server/goridge/v3
module github.com/roadrunner-server/goridge/v4

go 1.25

toolchain go1.25.0
go 1.26

require (
github.com/roadrunner-server/errors v1.4.1
github.com/stretchr/testify v1.10.0
github.com/vmihailenco/msgpack/v5 v5.4.1
google.golang.org/protobuf v1.36.7
github.com/stretchr/testify v1.11.1
google.golang.org/protobuf v1.36.11
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
18 changes: 6 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
Expand All @@ -17,16 +17,10 @@ github.com/roadrunner-server/errors v1.4.1/go.mod h1:qeffnIKG0e4j1dzGpa+OGY5VKSf
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
Expand Down
1 change: 1 addition & 0 deletions internal/bpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
TenMB uint32 = 1024 * 1024 * 10
)

// Preallocate initializes the tiered buffer pools. Must be called before ReceiveFrame.
func Preallocate() {
preallocate.Do(internalAllocate)
}
Expand Down
6 changes: 6 additions & 0 deletions internal/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Package internal contains shared utilities used by the relay
// implementations: tiered buffer pooling (1 MB / 5 MB / 10 MB) and the
// common frame-reception routine [ReceiveFrame].
//
// This package is not part of the public API.
package internal
5 changes: 3 additions & 2 deletions internal/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"time"

"github.com/roadrunner-server/errors"
"github.com/roadrunner-server/goridge/v3/pkg/frame"
"github.com/roadrunner-server/goridge/v4/pkg/frame"
)

// shortland for the Could not open input file: ../roadrunner/tests/psr-wfsdorker.php
var res = []byte("Could not op") //nolint:gochecknoglobals

const validationError = "validation failed on the message sent to STDOUT, see: https://docs.roadrunner.dev/error-codes/stdout-crc, invalid message: %s"

// ReceiveFrame reads a complete frame (header, options, and payload) from the relay into fr.
func ReceiveFrame(relay io.Reader, fr *frame.Frame) error {
const op = errors.Op("goridge_frame_receive")

Expand Down Expand Up @@ -86,7 +87,7 @@ func ReceiveFrame(relay io.Reader, fr *frame.Frame) error {
if err2 != nil {
if stderr.Is(err2, io.EOF) {
put(pl, pb)
return err
return err2
}
put(pl, pb)
return errors.E(op, err2)
Expand Down
Loading
Loading