Giter VIP home page Giter VIP logo

ntrip's Issues

Unauthorized - MissingRegion: could not find region configuration

I raised ntripcaster and try to connect to it using ntrip.NewServer
Here is my code:

func main() {

	conf := Config{}
	viper.SetConfigFile("caster.json")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	}

	err = viper.Unmarshal(&conf)
	if err != nil {
		panic(err)
	}


	server, _ := ntrip.NewServer("http://localhost" + conf.HTTP.Port + "/"  + conf.MountPoint)
	server.SetBasicAuth(conf.Username, conf.Password)
	go func() {
		for ; ; time.Sleep(time.Second * time.Duration(conf.Timeout)) {
			fmt.Println("server connecting")
			resp, err := server.Connect()
			if err != nil || resp.StatusCode != 200 {
				fmt.Println("server failed to connect", resp, err)
				continue
			}
			fmt.Println("server connected")
			ioutil.ReadAll(resp.Body)
			fmt.Println("server connection died")
		}
	}()

	go func() {
		client, _ := ntrip.NewClient(conf.RemoteCaster1.Url)
		client.SetBasicAuth(conf.RemoteCaster1.Username, conf.RemoteCaster1.Password)
		for ; ; time.Sleep(time.Second * time.Duration(conf.Timeout)) {
			resp, err := client.Connect()
			if err != nil || resp.StatusCode != 200 {
				fmt.Println("client failed to connect", resp, err)
				continue
			}

			fmt.Println("client connected")
			data := make([]byte, 4096)
			br, err := resp.Body.Read(data)
			for ; err == nil; br, err = resp.Body.Read(data) {
				//fmt.Println("write data from client to server")
				server.Write(data[:br])
			}
			fmt.Println("client connection died", err)
		}
	}()

	ntripcaster := caster.Caster{
		Mounts:  make(map[string]*caster.Mountpoint),
		Timeout: 5 * time.Second,
	} // TODO: Hide behind NewCaster which can include a DefaultAuthenticator
	ntripcaster.Authorizer = authorizers.NewCognitoAuthorizer(conf.Cognito.UserPoolID, conf.Cognito.ClientID)
	panic(ntripcaster.ListenHTTP(conf.HTTP.Port))
}

I get an error in the log:

server connecting
client connected
server failed to connect &{401 Unauthorized 401 HTTP/1.1 1 1 map[Date:[Sun, 12 Apr 2020 16:59:46 GMT] Ntrip-Version:[Ntrip/2.0] Server:[NTRIP GoCaster] X-Request-Id:[55cf3db3-c7dd-4bee-9931-fc1f0ce8c84d]] 0xc0003181c0 -1 [chunked] true map[] 0xc0002101a0 <nil>} <nil>
time="2020-04-12T19:59:46+03:00" level=error msg="Unauthorized - MissingRegion: could not find region configuration" method=POST path=/mount request_id=55cf3db3-c7dd-4bee-9931-fc1f0ce8c84d source_ip="[::1]:54947"

Server don't support NTRIP V1?

go run relay.go -source http://localhost:2101/TEST -dest http://BKG_CASTER:2101/MOUNTPOINT

The destination NTRIP BKG Caster/2.0.37 refuse the HTTP connexion.

Example of accepted connection by a BKG caster

/usr/local/bin/str2str -in ntrip://localhost:2101/TEST -out ntrips://BKG_CASTER:2101/MOUNTPOINT

Note:

  • The source and destination user and password are removed in all these examples for better reading.
  • str usage: see RTKLIB ver. 2.4.1 Manual

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.