gRelay is an open source project written in Go that provides the circuit break pattern with a relay idea behind.

Comments
  • Race condition test is failing (timeout error should appear)

    Race condition test is failing (timeout error should appear)

    Describe the bug The test called: TestGrelayRequestExecWithOneItemInQueueReturningErrGrelayServiceTimedoutShouldReturnErrGrelayServiceTimedout is falling in branch refactoring when we try to run make test-race-condition. We need to solve this issue before merge this PR to main.

    The current implementation works sometimes and other don't. We need to understand and fix this bug.

    To Reproduce Steps to reproduce the behavior:

    1. Run go test ./... -cpu=1,9 -race -count=50 -failfast -run GrelayRequestExecWithOneItemInQueueReturningErrGrelayServiceTimedoutShouldReturnErrGrelayServiceTimedout many times

    Expected behavior The test should pass without problems.

    Screenshots image

  • Update to go 1.18.0

    Update to go 1.18.0

    Update to go 1.18.0 #3

    Description

    Updated go version to use v.1.18, as promised code didn't require any modification to be supported in the new version.

    Solution

    • Updated go.mod with go 1.18
    • Added github actions matrix to test v.1.17 and v1.18 over mac and ubuntu
    • Tests validated

    Alternative Solution (optional)

    N/A

    @edualb

  • update to go 1.18.0

    update to go 1.18.0

    Is your feature request related to a problem? Please describe.

    • No. With the release of go 1.18, we want to use this version in our project to keep it updated. You can check all release notes here: https://tip.golang.org/doc/go1.18

    Describe the solution you'd like

    • Update our go.mod file with the new version
    • Update our code with all necessary modifications to keep working with go 1.18.0

    Describe alternatives you've considered

    • N/A

    Additional context

    • N/A
  • Include WithGo method config

    Include WithGo method config

    Is your feature request related to a problem? Please describe.

    In gRelay v0.0.x the default config is using goroutines which costs a lot of memory allocation as you can see in benchmark folder. To improve our future features, we need to do a refactor in our system.

    Describe the solution you'd like

    We would like to have an interface:

    type grelayExec interface {
    	exec(service GrelayService, func() (interface{}, error)) (interface{}, error)
    }
    

    and an implementation of this interface:

    type grelayExecWithGo struct {}
    
    func (e grelayExecWithGo) exec(service GrelayService, func() (interface{}, error)) (interface{}, error) {
    	// implementation
    }
    

    Change the grelayServiceImpl struct:

    type grelayServiceImpl struct {
    	// ...
    	realExec                    grelayExec
    	// ...
    }
    

    In NewGrelayService creates grelayExecWithGo:

    func NewGrelayService(c GrelayConfig) GrelayService {
    	var re grelayExec
    	if c.withGo {
    		re = grelayExecWithGo{}
    	}
    	g := &grelayServiceImpl{
    		// ...
    		realExec: re
    	}
    	// ...
    }
    

    In GrelayConfig include WithGo method and withGo attribute (put withGo = true as default in the future it will be false):

    type GrelayConfig struct {
    	// ...
    	withGo bool
    }
    
    func NewGrelayConfig() GrelayConfig {
    	return GrelayConfig{
    		withGo:           true,
    	}
    }
    
    func (c GrelayConfig) WithGo() GrelayConfig {
    	c.withGo = true
    	return c
    }
    

    move grelayServiceImpl.exec(f func() (interface{}, error)) to grelayExecWithGo.exec(service GrelayService, func() (interface{}, error)). In the final, we would like to have the grelayServiceImpl.exec(f func() (interface{}, error)) like that:

    func (g *grelayServiceImpl) exec(f func() (interface{}, error)) (interface{}, error) {
    	return g.realExec.exec(g, f)
    }
    
  • Increase time gap between timeout configuration and time.Sleep

    Increase time gap between timeout configuration and time.Sleep

    Increase time gap between timeout configuration and time.Sleep

    Description/Solution

    We did this change to avoid issues with time and parallel/concurrency. Because time.Sleep does not guarantee any time precision. So we need to increase the gap between times.

  • (refactoring) using context.WithTimeout instead of time.NewTimer

    (refactoring) using context.WithTimeout instead of time.NewTimer

    Using context.WithTimeout instead of time.NewTimer

    Race condition test is failing (timeout error should appear) (#6)

    Description

    We noticed that work with time precision is hard with parallel/concurrent program. Go (and many other languages) can't guaranteed the time precision of each goroutine.

    Solution

    Golang offer a pattern to deal with timeout that uses context.WithTimeout function and we are using it now.

    Besides that, we increase the gap between the time used in the test called TestGrelayRequestExecWithOneItemInQueueReturningErrGrelayServiceTimedoutShouldReturnErrGrelayServiceTimedout. Because there is no documented guaranty how precise time is. We must not assume some (especially low) precision.

  • Refactoring

    Refactoring

    Refactoring

    Description

    We want to organize the project following the https://github.com/golang-standards/project-layout structure.

    Solution

    We have created two packages:

    • pkg (exported packages)
    • internal (internal packages)

    Grelay now has new implementation for a circuit breaker. It is possible to check it in examples folder.

    These changes are important to prepare the application for the version 1.0.0. Grelay won't generate a new tag for that because there are more work to do.

  • V0.1.0

    V0.1.0

    #1 - Including WithGo function

    Description

    • feat: Including WithGo function that is responsible to execute in a goroutine your call function. If get ServiceTimeout, grelay will return instead of hold your call.
    • refactor: Improve performance using time.NewTimer and call Timer.Stop in final instead of time.After
Related tags
Message relay written in golang for PostgreSQL and Apache Kafka

Message Relay Message relay written in golang for PostgreSQL and Apache Kafka Requirements Docker and Docker Compose Local installation and using dock

Dec 19, 2021
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

frp README | 中文文档 What is frp? frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet. As of now, it s

Jan 5, 2023
rconn is a multiplatform program for creating generic reverse connections. Lets you consume services that are behind firewall or NAT without opening ports or port-forwarding.
rconn is a multiplatform program for creating generic reverse connections. Lets you consume services that are behind firewall or NAT without opening ports or port-forwarding.

rconn (r[everse] conn[ection]) is a multiplatform program for creating reverse connections. It lets you consume services that are behind NAT and/or fi

Jan 1, 2023
4chain is a simple、fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet.

4Chain What is 4chain? 4chain is a simple、fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet. Using the ssh

Nov 1, 2022
Create a dynamic fou tunnels works behind NAT

Dynamic Linux Tunneling This software creates Gretap Tunnels over FOU for Dynamic client endpoints. It also works behind NAT444 (CGN-LSN). You can use

Oct 17, 2022
Go-http-sleep: Delayed response http server, useful for testing various timeout issue for application running behind proxy

delayed response http server, useful for testing various timeout issue for application running behind proxy

Jan 22, 2022
“Dear Port80” is a zero-config TCP proxy server that hides SSH connection behind a HTTP server!

Dear Port80 About The Project: “Dear Port80” is a zero-config TCP proxy server that hides SSH connection behind a HTTP server! +---------------------

Jun 29, 2022
Server and relay side infrastructure for RDA

BitterJohn Server and relay side infrastructure for RDA. Usage install sudo ./BitterJohn install -g systemctl enable --now BitterJohn upgrade sudo ./B

Dec 14, 2022
Simple Relay between a Unix socket and a TCP socket, and vice versa.
Simple Relay between a Unix socket and a TCP socket, and vice versa.

Simple TCP <-> Unix Relay simpletcpunixrelay is a program which exposes a TCP endpoint as a Unix socket and vice versa. Usecase Let's say you are runn

Nov 23, 2022
Proxy - Minimalistic TCP relay proxy.

Proxy Minimalistic TCP relay proxy. Installation ensure you have go >= 1.17 installed clone the repo cd proxy go install main.go Examples Listen on po

May 22, 2022
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.

Connecting the Next Billion People Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core

Dec 31, 2022
Project Kebe is the open-source Snap Store implementation.

Introduction Kebe intends to be a full replacement for the Snap Store. Quickstart Once you have an environment setup (for instance using https://githu

Nov 9, 2022
Squzy - is a high-performance open-source monitoring, incident and alert system written in Golang with Bazel and love.

Squzy - opensource monitoring, incident and alerting system About Squzy - is a high-performance open-source monitoring and alerting system written in

Dec 12, 2022
An open source Pusher server implementation compatible with Pusher client libraries written in Go

Try browsing the code on Sourcegraph! IPÊ An open source Pusher server implementation compatible with Pusher client libraries written in Go. Why I wro

Aug 27, 2022
NebulaChat - Open source mtproto server written in golang
 NebulaChat - Open source mtproto server written in golang

NebulaChat - Open source mtproto server written in golang open source mtproto server implemented in golang with compatible telegram client. Introduce

Jan 5, 2023
A pluggable backend API that enforces the Event Sourcing Pattern for persisting & broadcasting application state changes
A pluggable backend API that enforces the Event Sourcing Pattern for persisting & broadcasting application state changes

A pluggable "Application State Gateway" that enforces the Event Sourcing Pattern for securely persisting & broadcasting application state changes

Nov 1, 2022
Go Domain Drived Design / Service repository pattern

Go Domain Drived Design / Service repository pattern Simple api domain drived design / service repository pattern API Overview every api (for each dom

Nov 28, 2022
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator

Trickster is an HTTP reverse proxy/cache for http applications and a dashboard query accelerator for time series databases. Learn more below, and chec

Jan 2, 2023