sourceHandshake sends the NTRIP v1 SOURCE request and streams raw RTCM data after the headers. The request uses a bare mountpoint (no leading slash) plus a STR line, matching the de-facto format produced by RTKLIB's str2str that NTRIP casters accept.
(conn net.Conn)
| 312 | // slash) plus a STR line, matching the de-facto format produced by RTKLIB's |
| 313 | // str2str that NTRIP casters accept. |
| 314 | func (c *Client) sourceHandshake(conn net.Conn) error { |
| 315 | mount := strings.TrimPrefix(c.config.Mountpoint, "/") |
| 316 | req := fmt.Sprintf( |
| 317 | "SOURCE %s %s\r\nSource-Agent: %s\r\nSTR: \r\n\r\n", |
| 318 | c.config.Password, mount, c.config.UserAgent, |
| 319 | ) |
| 320 | |
| 321 | c.logger.Info("sending SOURCE request", |
| 322 | "caster", c.config.Caster, |
| 323 | "mountpoint", mount, |
| 324 | ) |
| 325 | if _, err := conn.Write([]byte(req)); err != nil { |
| 326 | return fmt.Errorf("sending SOURCE request: %w", err) |
| 327 | } |
| 328 | |
| 329 | return nil |
| 330 | } |
| 331 | |
| 332 | // postHandshake sends the NTRIP v2 (HTTP POST) server request. The caster keeps |
| 333 | // the connection open and ingests the request body as an RTCM stream. Some |