Examples of NTRIP client implementations in client_test.go.
An example of setting up a Caster can be found in internal/inmemory.
NTRIP Client and Server
License: Apache License 2.0
Examples of NTRIP client implementations in client_test.go.
An example of setting up a Caster can be found in internal/inmemory.
I want to set the 2-second interval through the ntrip parameter
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"
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:
str
usage: see RTKLIB ver. 2.4.1 ManualA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.