bind: The requested address is not valid in its context

Пишу telegram бота на Golang. Запустил его на vds, ОС ubuntu 20.01, всё работает, но проблема в том, что я не могу дебажить такой запуск, приходится только на своем ПК в IDE писать код и каждый раз заливать и проверять работоспособность, но почти нереально понять причину каких-то ошибок без дебага. Решил я значит сделать из своего ПК "виртуальный сервер": открыл порт 8443, делал всё как на ubuntu, сгенерировал сертификаты и т.д. Но когда запускаю main.go вылазит:

listen tcp [ip]:8443: bind: The requested address is not valid in its context.

Ниже приложу код:

main.go

package main

import (
    "./configuration"
    "./get_data"
    "encoding/json"
    "fmt"
    tgBotApi "github.com/go-telegram-bot-api/telegram-bot-api"
    "io/ioutil"
    "net/http"
    "strings"
    "time"
)

var (
    NewBot, BotErr = tgBotApi.NewBotAPI(configuration.BOT_TOKEN)
)
func setWebhook(bot *tgBotApi.BotAPI) {
    webHookInfo := tgBotApi.NewWebhookWithCert(fmt.Sprintf("https://%s:%s/%s",
        configuration.BOT_HOST, configuration.BOT_PORT, configuration.BOT_TOKEN), configuration.CERT_FILE)
    _, err := bot.SetWebhook(webHookInfo)
    if err != nil {
        fmt.Println(err)
    }
}
func main () {
    fmt.Println("OK", time.Now().Unix(), time.Now(), time.Now().Weekday())
    setWebhook(NewBot)

    message := func (w http.ResponseWriter, r *http.Request) {
        text, _ := ioutil.ReadAll(r.Body)
        var botText = get_data.BotMessage{}
        _ = json.Unmarshal(text, &botText)
        chatGroup := int64(botText.Message.Chat.Id)
        botCommand := strings.Split(botText.Message.Text, "@")[0]

        /*markup := tgBotApi.InlineKeyboardMarkup{
            InlineKeyboard: [][]tgBotApi.InlineKeyboardButton{
                []tgBotApi.InlineKeyboardButton{
                    tgBotApi.InlineKeyboardButton{Text: "start"},
                },
            },
        }*/
        //reply := tgBotApi.NewEditMessageReplyMarkup(chatGroup, messageId, markup)
        var msg tgBotApi.MessageConfig
        switch botCommand {
            case "/start":
                msg = tgBotApi.NewMessage(chatGroup, helloCommandMsg())
                msg.ReplyMarkup = tgBotApi.NewReplyKeyboard(
                    []tgBotApi.KeyboardButton{catalogBtn.Btn},
                    []tgBotApi.KeyboardButton{myProfileBtn.Btn, supportBtn.Btn},
                    []tgBotApi.KeyboardButton{getLuckyBtn.Btn, rulesBtn.Btn},
                    []tgBotApi.KeyboardButton{addFundsBtn.Btn},
                )
                break
            case getLuckyBtn.Btn.Text:
                getLuckyBtn.Action(botText, NewBot)
                break
            case myProfileBtn.Btn.Text:
                myProfileBtn.Action(botText, NewBot)
                break
            case addFundsBtn.Btn.Text:
                addFundsBtn.Action(botText, NewBot)
                break
            default:
                msg = tgBotApi.NewMessage(chatGroup, unknownCommandMsg())
        }
        NewBot.Send(msg)
    }
    http.HandleFunc("/", message)
    errListenTLS := http.ListenAndServeTLS(fmt.Sprintf("%s:%s", configuration.BOT_HOST, configuration.BOT_PORT), configuration.CERT_FILE, configuration.CERT_KEY, nil)
    if errListenTLS != nil {
        fmt.Println(errListenTLS)
    }
}

configuration/main_config.go:

package configuration

const (
    TELEGRAM_URL = "https://api.telegram.org/bot"
    BOT_TOKEN = "mytoken"
    BOT_HOST = "[ip]"
    BOT_PORT = "8443"
)

configuration/cert_config.go:

package configuration

const (
    CERT_FILE = "C:\\Users\\USER\\Desktop\\GOlocal\\BOTlocal\\certificates\\mybot.pem"
    CERT_KEY = "C:\\Users\\USER\\Desktop\\GOlocal\\BOTlocal\\certificates\\mybot.key"
)

Сертификаты генерировал, как сказано здесь: https://stackoverflow.com/questions/42713926/what-is-easy-way-to-create-and-use-a-self-signed-certification-for-a-telegram-we

Также пробовал вместо своего публичного ip-адреса([ip]) ставить такой -> 0.0.0.0 В таком случае появляется другая ошибка:

Bad Request: bad webhook: IP address 0.0.0.0 is reserved

Ответы (0 шт):