Coder Social home page Coder Social logo

ursiform / sleuth Goto Github PK

View Code? Open in Web Editor NEW
370.0 370.0 26.0 223 KB

A Go library for master-less peer-to-peer autodiscovery and RPC between HTTP services

Home Page: http://ursiform.github.io/sleuth/

License: MIT License

Go 97.59% Shell 2.41%
discovery distributed-computing distributed-systems golang peer-autodiscovery rpc service-autodiscovery sleuth zeromq

sleuth's People

Contributors

afshin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sleuth's Issues

Can't find/use services which are already running on the network

Hi !
I have this code running on multiple computers on the same network

package main


import (
	"bytes"
	"fmt"
	"github.com/gorilla/mux"
	"github.com/ursiform/sleuth"
	"net/http"
	"time"
)

var (
	client *sleuth.Client
)

func handler(res http.ResponseWriter, req *http.Request) {
	fmt.Println("test :D")
}

func main() {
	router := mux.NewRouter()
	router.HandleFunc("/", handler).Methods("POST")
	client, _ = sleuth.New(&sleuth.Config{Service: "comment-service", Handler: router})

	go surveilCurrentAvailableServices()

	fmt.Println("ready...")
	http.ListenAndServe(":9872", router)
}

func surveilCurrentAvailableServices() {
	for {
		fmt.Println(client)
		client.WaitFor("comment-service")

		//try to make a post to the another services
		input := "This is the value I am inputting."
		body := bytes.NewBuffer([]byte(input))
		request, _ := http.NewRequest("POST", "sleuth://comment-service/", body)
		client.Do(request)
		time.Sleep(500 * time.Millisecond)
	}
}

I run the code first on C1 (computer 1) then C2 and then C3

With the fmt.Println(client) I get this client object:

  • On C1:
    &{500ms 0xc8201046e0 false SLEUTH-v1 145 0xc8200145a0 0xc820102470 0xc8200e2128 0xc820014640 map[B18125:comment-service F5C8BB:comment-service] 0xc820102480}

  • On C2
    &{500ms 0x107ce3d0 false SLEUTH-v1 0 0x10712540 0x107cc120 0x107be7bc 0x10712630 map[B18125:comment-service] 0x107cc128}

  • On C3:
    &{500ms 0x107ce3d0 false SLEUTH-v1 0 0x10712540 0x107cc120 0x107be7cc 0x10712630 map[] 0x107cc128}

So C1 detect C2 and C3 but C3 doesn't find the service of C1.
So when you run the code sleuth doesn't find services which are already running on another devices on the network.

Is that an issue or is there a solution for that?

Moreover the POST request made on sleuth://comment-service/ doesn't work and I doesn't understand why.

Thanks in advance!

Best regards

Issue with UDP communication on finding a service

I am having an issue with service discovery using Sleuth. I have followed your example without any changes except specifying the interface on the config. I've also made sure all UDP/TCP ports are open but still my client is not able to discover the service, it just keeps hanging on WaitFor(). If I run the service and client on same machine it works obviously but not when I run them on different machines on the same network.

I have been using Sleuth with latest Gyre version (go get ) and libzmq 4.2.1/4.2.3.

Is there any specific version of Gyre and libzmq that Sleuth requires as it seems Sleuth hasn't been updated for quite some time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.