From 576adb547cac5a3484aa1c53881e69bf0f729afd Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Wed, 8 Jan 2025 23:20:38 +0200 Subject: Implemented CD --- internal/client/config/config.go | 16 ++++++++++------ internal/client/gateway/gateway.go | 11 +++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'internal/client') diff --git a/internal/client/config/config.go b/internal/client/config/config.go index daa3d58..0d81405 100644 --- a/internal/client/config/config.go +++ b/internal/client/config/config.go @@ -10,16 +10,20 @@ import ( ) type Config struct { - PrivateKeyPath string `json:"private_key_path"` - InsertModeTabToSpace bool `json:"insert_mode_tab_to_space"` - InsertModeSpacesPerTab uint8 `json:"insert_mode_spaces_per_tab"` + ServerName string `json:"server_name"` + PrivateKeyPath string `json:"private_key_path"` + InsertModeTabToSpace bool `json:"insert_mode_tab_to_space"` + InsertModeSpacesPerTab uint8 `json:"insert_mode_spaces_per_tab"` + InsecureSkipServerVerification bool `json:"insecure_skip_server_verification"` } func Default() Config { return Config{ - PrivateKeyPath: "", - InsertModeTabToSpace: true, - InsertModeSpacesPerTab: 4, + ServerName: "eko.kyren.codes", + PrivateKeyPath: "", + InsertModeTabToSpace: true, + InsertModeSpacesPerTab: 4, + InsecureSkipServerVerification: false, } } diff --git a/internal/client/gateway/gateway.go b/internal/client/gateway/gateway.go index 11d15bb..38140e8 100644 --- a/internal/client/gateway/gateway.go +++ b/internal/client/gateway/gateway.go @@ -15,6 +15,7 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/kyren223/eko/certs" + "github.com/kyren223/eko/internal/client/config" "github.com/kyren223/eko/internal/client/ui" "github.com/kyren223/eko/internal/packet" "github.com/kyren223/eko/pkg/assert" @@ -44,9 +45,10 @@ func init() { } tlsConfig = &tls.Config{ - RootCAs: certPool, - ServerName: "localhost", - MinVersion: tls.VersionTLS12, + RootCAs: certPool, + ServerName: config.Read().ServerName, + MinVersion: tls.VersionTLS12, + InsecureSkipVerify: config.Read().InsecureSkipServerVerification, } } @@ -71,7 +73,8 @@ func connect(ctx context.Context, privKey ed25519.PrivateKey) (snowflake.ID, err errChan := make(chan error, 1) go func() { framer = packet.NewFramer() - connection, err := tls.Dial("tcp4", ":7223", tlsConfig) + address := config.Read().ServerName + connection, err := tls.Dial("tcp4", address + ":7223", tlsConfig) if err != nil { errChan <- err return -- cgit v1.3.1