Compare commits

..

No commits in common. "bc4aeb3124ef3b1806a34fb39f7cbbf9ec999e35" and "aac3959dc72891fc86777d01e6e9603c7c19e6cd" have entirely different histories.

4 changed files with 19 additions and 68 deletions

View File

@ -3,34 +3,25 @@ before:
- go mod download
- go generate ./...
builds:
- main: ./cmd/sclient/
- main: ./cmd/sclient/main.go
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- freebsd
- windows
- js
- darwin
goarch:
- 386
- amd64
- arm
- arm64
- wasm
goarm:
- 6
- 7
goamd64:
- v2
ignore:
- goos: windows
goarch: 386
- goos: windows
goarm: 6
- goos: windows
goarm: 7
archives:
- id: sclient-binary
format: tar.xz
- replacements:
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip

View File

@ -70,11 +70,10 @@ sclient [flags] <remote> <local>
```
- flags
- `-s`, `--silent` less verbose logging
- `-k`, `--insecure` ignore invalid TLS (SSL/HTTPS) certificates
- `--servername <domain>` spoof SNI (to disable use IP as &lt;remote&gt; and do
- -s, --silent less verbose logging
- -k, --insecure ignore invalid TLS (SSL/HTTPS) certificates
- --servername <string> spoof SNI (to disable use IP as &lt;remote&gt; and do
not use this option)
- `--alpn <protocol-list>`
- remote
- must have servername (i.e. example.com)
- port is optional (default is 443)
@ -82,17 +81,6 @@ sclient [flags] <remote> <local>
- address is optional (default is localhost)
- must have port (i.e. 3000)
-alpn string
acceptable protocols, ex: 'h2,http/1.1' 'http/1.1' (default) 'ssh' (default "http/1.1")
-insecure
ignore bad TLS/SSL/HTTPS certificates
-k alias for --insecure
-s alias of --silent
-servername string
specify a servername different from <remote> (to disable SNI use an IP as <remote> and do use this option)
-silent
less verbose output
# Examples
Bridge between `telebit.cloud` and local port `3000`.

View File

@ -40,30 +40,20 @@ func usage() {
func main() {
if len(os.Args) >= 2 {
if os.Args[1] == "-V" || strings.TrimLeft(os.Args[1], "-") == "version" {
if "version" == strings.TrimLeft(os.Args[1], "-") {
fmt.Printf("%s\n", ver())
os.Exit(0)
return
}
}
var alpnList string
var insecure bool
var servername string
var silent bool
flag.Usage = usage
flag.StringVar(&alpnList, "alpn", "", "acceptable protocols, ex: 'h2,http/1.1' 'http/1.1' 'ssh'")
flag.BoolVar(&insecure, "k", false, "alias for --insecure")
flag.BoolVar(&silent, "s", false, "alias of --silent")
flag.StringVar(&servername, "servername", "", "specify a servername different from <remote> (to disable SNI use an IP as <remote> and do not use this option)")
flag.BoolVar(&insecure, "insecure", false, "ignore bad TLS/SSL/HTTPS certificates")
flag.BoolVar(&silent, "silent", false, "less verbose output")
insecure := flag.Bool("k", false, "alias for --insecure")
silent := flag.Bool("s", false, "alias of --silent")
servername := flag.String("servername", "", "specify a servername different from <remote> (to disable SNI use an IP as <remote> and do use this option)")
flag.BoolVar(insecure, "insecure", false, "ignore bad TLS/SSL/HTTPS certificates")
flag.BoolVar(silent, "silent", false, "less verbose output")
flag.Parse()
alpns := parseOptionList(alpnList)
remotestr := flag.Arg(0)
localstr := flag.Arg(1)
@ -81,10 +71,9 @@ func main() {
sclient := &sclient.Tunnel{
RemotePort: 443,
LocalAddress: "localhost",
InsecureSkipVerify: insecure,
ServerName: servername,
Silent: silent,
NextProtos: alpns,
InsecureSkipVerify: *insecure,
ServerName: *servername,
Silent: *silent,
}
remote := strings.Split(remotestr, ":")
@ -135,18 +124,3 @@ func main() {
//os.Exit(6)
}
}
// parsers "a,b,c" "a b c" and "a, b, c" all the same
func parseOptionList(optionList string) []string {
optionList = strings.TrimSpace(optionList)
if len(optionList) == 0 {
return nil
}
options := []string{}
optionList = strings.ReplaceAll(optionList, ",", " ")
options = strings.Fields(optionList)
return options
}

View File

@ -17,7 +17,6 @@ type Tunnel struct {
LocalAddress string
LocalPort int
InsecureSkipVerify bool
NextProtos []string
ServerName string
Silent bool
}
@ -30,7 +29,6 @@ func (t *Tunnel) DialAndListen() error {
&tls.Config{
ServerName: t.ServerName,
InsecureSkipVerify: t.InsecureSkipVerify,
NextProtos: t.NextProtos,
})
if err != nil {