Skip to content

Commit

Permalink
Merge pull request #135 from loopholelabs/staging
Browse files Browse the repository at this point in the history
Release v0.5.1
  • Loading branch information
ShivanshVij committed Jul 21, 2022
2 parents a210667 + 544d5d3 commit 0799cec
Show file tree
Hide file tree
Showing 75 changed files with 430 additions and 5,823 deletions.
22 changes: 0 additions & 22 deletions .deepsource.toml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/benchmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: Go Build Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: Go Build Cache
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml → .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
key: trunk-${{ runner.os }}

- name: Trunk Check
uses: trunk-io/trunk-action@v1.0.0
uses: trunk-io/trunk-action@v1
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml → .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: Go Build Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: Go Build Cache
uses: actions/cache@v2
Expand Down
1 change: 1 addition & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*out
*log
13 changes: 9 additions & 4 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
version: 0.1
cli:
version: 0.11.0-beta
version: 0.15.0-beta
lint:
enabled:
- gitleaks@8.7.1
- gofmt@1.18.1
- golangci-lint@1.45.2
- actionlint@1.6.13
- gitleaks@8.8.7
- gofmt@1.18.3
- golangci-lint@1.46.2
- markdownlint@0.31.1
- prettier@2.6.2
ignore:
- linters: [ALL]
paths:
- dist/**
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [v0.5.1] - 2022-07-20 (Beta)

## Fixes

- Fixed an issue where new connections in the server would be overwritten sometimes due to a pointer error

## Changes

- FRPC is now called fRPC
- fRPC has been moved into its own [repository](https://github.com/loopholelabs/frpc-go)
- We're using the [Common](https://github.com/loopholelabs/common) library for our queues and packets
- Packets now use the [Polyglot-Go](https://github.com/loopholelabs/polylgot-go) library for serialization

## [v0.5.0] - 2022-05-18 (Beta)

## Changes
Expand Down Expand Up @@ -265,7 +278,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Initial Release of Frisbee

[unreleased]: https://github.com/loopholelabs/frisbee/compare/v0.4.6...HEAD
[unreleased]: https://github.com/loopholelabs/frisbee/compare/v0.5.1...HEAD
[v0.5.1]: https://github.com/loopholelabs/frisbee/compare/v0.5.0...v0.5.1
[v0.5.0]: https://github.com/loopholelabs/frisbee/compare/v0.4.6...v0.5.0
[v0.4.6]: https://github.com/loopholelabs/frisbee/compare/v0.4.5...v0.4.6
[v0.4.5]: https://github.com/loopholelabs/frisbee/compare/v0.4.4...v0.4.5
[v0.4.4]: https://github.com/loopholelabs/frisbee/compare/v0.4.3...v0.4.4
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Frisbee uses GitHub to manage reviews of pull requests.
[MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.

- If you plan to do something more involved, first discuss your ideas
on our [slack](https://join.slack.com/t/loopholelabs/shared_invite/zt-pntffh2t-l6mQJdBDafG3x1JJabMAFA).
on our [discord](https://loopholelabs.io/discord).
This will avoid unnecessary work and surely give you and us a good deal
of inspiration.

Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Shivansh Vij <shivanshvij@loopholelabs.io> @shivanshvij
- Alex Sørlie Glomsaas <alexsorlieglomsaas@loopholelabs.io> @supermanifolds
- Felicitas Pojtinger <felicitaspojtinger@loopholelabs.io> @pojntfx
54 changes: 13 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# Frisbee
# Frisbee-Go

[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Tests](https://github.com/loopholelabs/frisbee/actions/workflows/tests.yml/badge.svg)](https://github.com/loopholelabs/frisbee/actions/workflows/tests.yml)
[![Benchmarks](https://github.com/loopholelabs/frisbee/actions/workflows/benchmarks.yaml/badge.svg)](https://github.com/loopholelabs/frisbee/actions/workflows/benchmarks.yaml)
[![Go Report Card](https://goreportcard.com/badge/github.com/loopholelabs/frisbee)](https://goreportcard.com/report/github.com/loopholelabs/frisbee)
[![go-doc](https://godoc.org/github.com/loopholelabs/frisbee?status.svg)](https://godoc.org/github.com/loopholelabs/frisbee)
[![Tests](https://github.com/loopholelabs/frisbee-go/actions/workflows/tests.yaml/badge.svg)](https://github.com/loopholelabs/frisbee-go/actions/workflows/tests.yaml)
[![Benchmarks](https://github.com/loopholelabs/frisbee-go/actions/workflows/benchmarks.yaml/badge.svg)](https://github.com/loopholelabs/frisbee-go/actions/workflows/benchmarks.yaml)
[![Go Report Card](https://goreportcard.com/badge/github.com/loopholelabs/frisbee-go)](https://goreportcard.com/report/github.com/loopholelabs/frisbee-go)
[![go-doc](https://godoc.org/github.com/loopholelabs/frisbee-go?status.svg)](https://godoc.org/github.com/loopholelabs/frisbee-go)

This is the [Go](http://golang.org) library for
[Frisbee](https://frpc.io/concepts/frisbee), a bring-your-own protocol messaging framework designed for performance and
This is the [Go](http://golang.org) implementation of [Frisbee](https://frpc.io/frisbee), a bring-your-own
protocol messaging framework designed for performance and
stability.

[FRPC](https://frpc.io) is a lightweight, fast, and secure RPC framework for Go that uses Frisbee under the hood. This
repository houses both projects, with **FRPC** being contained in the
[protoc-gen-frpc]("/protoc-gen-frpc") folder.

**This library requires Go1.16 or later.**
**This library requires Go1.18 or later.**

## Important note about releases and stability

Expand All @@ -26,37 +22,14 @@ same is true for selected other new features explicitly marked as
## Usage and Documentation

Usage instructions and documentation for Frisbee is available
at [https://frpc.io/concepts/frisbee](https://frpc.io/concepts/frisbee). The Frisbee framework also has great
documentation coverage using [GoDoc](https://godoc.org/github.com/loopholelabs/frisbee).

## FRPC

The FRPC Generator is still in very early **Alpha**. While it is functional and being used within other products
we're building at [Loophole Labs][loophomepage], the `proto3` spec has a myriad of edge-cases that make it difficult to
guarantee validity of generated RPC frameworks without extensive real-world use.

That being said, as the library matures and usage of FRPC grows we'll be able to increase our testing
coverage and fix any edge case bugs. One of the major benefits to the RPC framework is that reading the generated code
is extremely straight forward, making it easy to debug potential issues down the line.

### Usage and Documentation

Usage instructions and documentations for FRPC are available at [https://frpc.io/](https://frpc.io).

### Unsupported Features

The Frisbee RPC Generator currently does not support the following features, though they are actively being worked on:

- `OneOf` Message Types
- Streaming Messages between the client and server

Example `Proto3` files can be found [here](/protoc-gen-frpc/examples).
at [https://frpc.io/frisbee](https://frpc.io/frisbee). The Frisbee framework also has great
documentation coverage using [GoDoc](https://godoc.org/github.com/loopholelabs/frisbee-go).

## Contributing

Bug reports and pull requests are welcome on GitHub at [https://github.com/loopholelabs/frisbee][gitrepo]. For more
Bug reports and pull requests are welcome on GitHub at [https://github.com/loopholelabs/frisbee-go][gitrepo]. For more
contribution information check
out [the contribution guide](https://github.com/loopholelabs/frisbee/blob/master/CONTRIBUTING.md).
out [the contribution guide](https://github.com/loopholelabs/frisbee-go/blob/master/CONTRIBUTING.md).

## License

Expand All @@ -71,7 +44,6 @@ Everyone interacting in the Frisbee project’s codebases, issue trackers, chat

[![https://loopholelabs.io][loopholelabs]](https://loopholelabs.io)

[gitrepo]: https://github.com/loopholelabs/frisbee
[gitrepo]: https://github.com/loopholelabs/frisbee-go
[loopholelabs]: https://cdn.loopholelabs.io/loopholelabs/LoopholeLabsLogo.svg
[homepage]: https://loopholelabs.io/docs/frisbee
[loophomepage]: https://loopholelabs.io
20 changes: 10 additions & 10 deletions async.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"context"
"crypto/tls"
"encoding/binary"
"github.com/loopholelabs/frisbee/internal/dialer"
"github.com/loopholelabs/frisbee/internal/queue"
"github.com/loopholelabs/frisbee/pkg/metadata"
"github.com/loopholelabs/frisbee/pkg/packet"
"github.com/loopholelabs/common/pkg/queue"
"github.com/loopholelabs/frisbee-go/internal/dialer"
"github.com/loopholelabs/frisbee-go/pkg/metadata"
"github.com/loopholelabs/frisbee-go/pkg/packet"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"go.uber.org/atomic"
Expand All @@ -43,7 +43,7 @@ type Async struct {
closed *atomic.Bool
writer *bufio.Writer
flusher chan struct{}
incoming *queue.Circular
incoming *queue.Circular[packet.Packet, *packet.Packet]
logger *zerolog.Logger
wg sync.WaitGroup
error *atomic.Error
Expand Down Expand Up @@ -85,7 +85,7 @@ func NewAsync(c net.Conn, logger *zerolog.Logger) (conn *Async) {
conn: c,
closed: atomic.NewBool(false),
writer: bufio.NewWriterSize(c, DefaultBufferSize),
incoming: queue.NewCircular(DefaultBufferSize),
incoming: queue.NewCircular[packet.Packet, *packet.Packet](DefaultBufferSize),
flusher: make(chan struct{}, 3),
logger: logger,
error: atomic.NewError(nil),
Expand Down Expand Up @@ -174,11 +174,11 @@ func (c *Async) CloseChannel() <-chan struct{} {
//
// If packet.Metadata.ContentLength == 0, then the content array must be nil. Otherwise, it is required that packet.Metadata.ContentLength == len(content).
func (c *Async) WritePacket(p *packet.Packet) error {
if int(p.Metadata.ContentLength) != len(p.Content.B) {
if int(p.Metadata.ContentLength) != len(*p.Content) {
return InvalidContentLength
}

encodedMetadata := metadata.Get()
encodedMetadata := metadata.GetBuffer()
binary.BigEndian.PutUint16(encodedMetadata[metadata.IdOffset:metadata.IdOffset+metadata.IdSize], p.Metadata.Id)
binary.BigEndian.PutUint16(encodedMetadata[metadata.OperationOffset:metadata.OperationOffset+metadata.OperationSize], p.Metadata.Operation)
binary.BigEndian.PutUint32(encodedMetadata[metadata.ContentLengthOffset:metadata.ContentLengthOffset+metadata.ContentLengthSize], p.Metadata.ContentLength)
Expand All @@ -190,7 +190,7 @@ func (c *Async) WritePacket(p *packet.Packet) error {
}

_, err := c.writer.Write(encodedMetadata[:])
metadata.Put(encodedMetadata)
metadata.PutBuffer(encodedMetadata)
if err != nil {
c.Unlock()
if c.closed.Load() {
Expand All @@ -213,7 +213,7 @@ func (c *Async) WritePacket(p *packet.Packet) error {
return c.closeWithError(err)
}
}
_, err = c.writer.Write(p.Content.B[:p.Metadata.ContentLength])
_, err = c.writer.Write((*p.Content)[:p.Metadata.ContentLength])
if err != nil {
c.Unlock()
if c.closed.Load() {
Expand Down
Loading

0 comments on commit 0799cec

Please sign in to comment.