Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
costap committed May 9, 2020
2 parents ac903c5 + f3e136b commit d40babf
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 69 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ _take note of new host external IP and replace <NEWHOSTIP> below_

4. start the tunnels
```shell script
tunneld -c ~/.ssh/id_rsa_tunnel --sshServer root@<NEWHOSTIP> --localAddr 192.168.0.26:443 --remoteAddr 0.0.0.0:10443
tunneld -c ~/.ssh/id_rsa_tunnel --sshServer root@<NEWHOSTIP> --localAddr 192.168.0.26:6443 --remoteAddr 0.0.0.0:16443
nohup tunneld -c ~/.ssh/id_rsa_tunnel \
--sshServer root@<NEWHOSTIP> \
--localAddr 192.168.0.26:443 \
--remoteAddr 0.0.0.0:10443 \
--adminPort 8080 > /dev/null 2>&1 &
tunneld -c ~/.ssh/id_rsa_tunnel \
--sshServer root@<NEWHOSTIP> \
--localAddr 192.168.0.26:6443 \
--remoteAddr 0.0.0.0:16443 \
--adminPort 8081 > /dev/null 2>&1 &
```
5. Enjoy!

## Build

Expand Down
51 changes: 0 additions & 51 deletions cmd/tunnelctl/tunnel-test

This file was deleted.

1 change: 0 additions & 1 deletion cmd/tunnelctl/tunnel-test.pub

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/tunneld/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {
http.HandleFunc("/health", health)
http.HandleFunc("/stop", stop)

log.Fatal(http.ListenAndServe(":8080", nil))
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%v",c.AdminPort), nil))
}

func index(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion configs/tunnelctl.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
token: <you digital ocean>
token: <your digital ocean API token>
region: lon1
16 changes: 5 additions & 11 deletions internal/app/tunneld/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,16 @@ const (
TCP
)

type Config interface {
GetMode() Mode
}

type SSHConfig struct {
type Config struct {
Password string
Cert string
SSHServer string
RemoteAddr string
LocalAddr string
AdminPort int
}

func (*SSHConfig) GetMode() Mode {
return SSH
}

func ConfigInit() *SSHConfig {
func ConfigInit() *Config {
viper.SetConfigName("config")
viper.SetConfigType("yaml")
viper.AddConfigPath(".")
Expand All @@ -54,10 +47,11 @@ func ConfigInit() *SSHConfig {
flag.String("remoteAddr", "0.0.0.0:8080", "remote interface and port to listen on")
flag.String("localAddr", "", "local address to connect through the tunnel")
flag.String("type", "ssh", "type of tunnel, only ssh is currently supported")
flag.Int("adminPort", 8080, "admin port")
flag.Parse()
viper.BindPFlags(flag.CommandLine)

var c SSHConfig
var c Config

if err := viper.Unmarshal(&c); err != nil {
log.Fatalf("unable to decode into struct, %v", err)
Expand Down
4 changes: 2 additions & 2 deletions internal/app/tunneld/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
type Server struct {
running bool
started bool
config *SSHConfig
config *Config
}

func NewServer(config *SSHConfig) *Server {
func NewServer(config *Config) *Server {
return &Server{running: false, started: false, config: config}
}

Expand Down

0 comments on commit d40babf

Please sign in to comment.