File: connect.go

package info (click to toggle)
pat 0.19.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,296 kB
  • sloc: javascript: 3,891; sh: 124; makefile: 11
file content (70 lines) | stat: -rw-r--r-- 2,874 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package cli

import (
	"context"
	"fmt"
	"os"

	"github.com/la5nta/pat/app"
)

func ConnectHandle(_ context.Context, app *app.App, args []string) {
	if args[0] == "" {
		fmt.Println("Missing argument, try 'connect help'.")
	}

	app.PromptHub().AddPrompter(TerminalPrompter{})

	if success := app.Connect(args[0]); !success {
		os.Exit(1)
	}
}

const (
	UsageConnect = `'alias' or 'transport://[host][/digi]/targetcall[?params...]'

transport:
  telnet:          TCP/IP
  ardop:           ARDOP TNC
  pactor:          SCS PTC modems
  varahf:          VARA HF TNC
  varafm:          VARA FM TNC
  ax25:            AX.25 (Default - uses engine specified in config)
  ax25+agwpe:      AX.25 (AGWPE/Direwolf)
  ax25+linux:      AX.25 (Linux kernel)
  ax25+serial-tnc: AX.25 (Serial TNC)

host:
  Used to address the host interface (TNC/modem), _not_ to be confused with the connection PATH.
    Format: [user[:pass]@]host[:port]

  telnet:       [user:pass]@host:port
  ax25+linux:   (optional) host=axport
  pactor:       (optional) serial device (e.g. COM1 or /dev/ttyUSB0)

path:
  The last element of the path is the target station's callsign. If the path has
   multiple hops (e.g. AX.25), they are separated by '/'.

params:
  ?freq=        Sets QSY frequency (ardop and ax25 only)
  ?host=        Overrides the host part of the path. Useful for serial-tnc to specify e.g. /dev/ttyS0.
  ?prehook=     Sets an executable middleware to run before the connection is handed over to the B2F protocol.
                 The executable must be given as full path, or a file located in $PATH or {CONFIG_DIR}/prehooks/.
		 Received packets are forwarded to STDIN. Data written to STDOUT forwarded to the remote node.
		 Additional arguments can be passed with one or more &prehook-arg=.
		 Environment variables describing the dialed connection are provided.
                 Useful for packet node traversal. Supported across all transports.
`
	ExampleConnect = `
  connect telnet                       (alias) Connect to one of the Winlink Common Message Servers via tcp.
  connect ax25:///LA1B-10              Connect to the RMS Gateway LA1B-10 using AX.25 engine as per configuration.
  connect ax25+linux://tmd710/LA1B-10  Connect to LA1B-10 using Linux kernel's AX.25 stack on axport 'tmd710'.
  connect ax25:///LA1B/LA5NTA          Peer-to-peer connection with LA5NTA via LA1B digipeater.
  connect ardop:///LA3F                Connect to the RMS HF Gateway LA3F using ARDOP on the default tcp address and port.
  connect ardop:///LA3F?freq=5350      Same as above, but set dial frequency of the radio using rigcontrol.  
  connect pactor:///LA3F               Connect to RMS HF Gateway LA3F using PACTOR.
  connect varahf:///LA1B               Connect to RMS HF Gateway LA1B using VARA HF TNC.
  connect varafm:///LA5NTA             Connect to LA5NTA using VARA FM TNC.
`
)