You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/images/agnhost/connect/connect.go
+46-2Lines changed: 46 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23,14 +23,15 @@ import (
23
23
"syscall"
24
24
"time"
25
25
26
+
"github.com/ishidawataru/sctp"
26
27
"github.com/spf13/cobra"
27
28
)
28
29
29
30
// CmdConnect is used by agnhost Cobra.
30
31
varCmdConnect=&cobra.Command{
31
32
Use: "connect [host:port]",
32
-
Short: "Attempts a TCP connection and returns useful errors",
33
-
Long: `Tries to open a TCP connection to the given host and port. On error it prints an error message prefixed with a specific fixed string that test cases can check for:
33
+
Short: "Attempts a TCP or SCTP connection and returns useful errors",
34
+
Long: `Tries to open a TCP or SCTP connection to the given host and port. On error it prints an error message prefixed with a specific fixed string that test cases can check for:
34
35
35
36
* UNKNOWN - Generic/unknown (non-network) error (eg, bad arguments)
36
37
* TIMEOUT - The connection attempt timed out
@@ -42,14 +43,27 @@ var CmdConnect = &cobra.Command{
42
43
}
43
44
44
45
vartimeout time.Duration
46
+
varprotocolstring
45
47
46
48
funcinit() {
47
49
CmdConnect.Flags().DurationVar(&timeout, "timeout", time.Duration(0), "Maximum time before returning an error")
50
+
CmdConnect.Flags().StringVar(&protocol, "protocol", "tcp", "The protocol to use to perform the connection, can be tcp or sctp")
Copy file name to clipboardExpand all lines: test/images/agnhost/porter/porter.go
+52-8Lines changed: 52 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -29,19 +29,24 @@ import (
29
29
"os"
30
30
"strings"
31
31
32
+
"github.com/ishidawataru/sctp"
32
33
"github.com/spf13/cobra"
33
34
)
34
35
35
-
constprefix="SERVE_PORT_"
36
+
consttcpPrefix="SERVE_PORT_"
37
+
constsctpPrefix="SERVE_SCTP_PORT_"
36
38
consttlsPrefix="SERVE_TLS_PORT_"
37
39
38
40
// CmdPorter is used by agnhost Cobra.
39
41
varCmdPorter=&cobra.Command{
40
42
Use: "porter",
41
43
Short: "Serves requested data on ports specified in ENV variables",
42
-
Long: `Serves requested data on ports specified in ENV variables. For example, if the environment variable "SERVE_PORT_9001" is set, then the subcommand will start serving on the port 9001.
43
-
44
-
Additionally, if the environment variable "SERVE_TLS_PORT_9002" is set, then the subcommand will start a TLS server on that port.
44
+
Long: `Serves requested data on ports specified in environment variables of the form SERVE_{PORT,TLS_PORT,SCTP_PORT}_[NNNN].
45
+
46
+
eg:
47
+
* SERVE_PORT_9001 - serve TCP connections on port 9001
48
+
* SERVE_TLS_PORT_9002 - serve TLS-encrypted TCP connections on port 9002
49
+
* SERVE_SCTP_PORT_9003 - serve SCTP connections on port 9003
45
50
46
51
The included "localhost.crt" is a PEM-encoded TLS cert with SAN IPs "127.0.0.1" and "[::1]", expiring in January 2084, generated from "src/crypto/tls".
0 commit comments