Philipp15b / go-steam

Steam's protocol in Go to allow automation of different actions on the Steam network without running an actual Steam client. Includes APIs for friends, chatting, trading, trade offers and TF2 crafting.
https://pkg.go.dev/github.com/Philipp15b/go-steam/v3
Other
391 stars 131 forks source link

Connection timeout #141

Open RandomNick2 opened 5 months ago

RandomNick2 commented 5 months ago

Connection timeout but i have good network

 package main

import (
    "fmt"
    "github.com/Philipp15b/go-steam"
    "github.com/Philipp15b/go-steam/protocol/steamlang"
    "log"
)

func main() {
    fmt.Println("started")
    loginInfo := new(steam.LogOnDetails)
    loginInfo.Username = "xozihox283"
    loginInfo.Password = "tj3JXH39"

    client := steam.NewClient()
    client.ConnectEurope()

    for event := range client.Events() {
        switch e := event.(type) {
        case *steam.ConnectedEvent:
            fmt.Println("connected")
            client.Auth.LogOn(loginInfo)
        case *steam.LoggedOnEvent:
            fmt.Println("LoggedOn")
            client.Social.SetPersonaState(steamlang.EPersonaState_Online)
        case steam.FatalErrorEvent:
            log.Print(e)
        case error:
            log.Print(e)
        }
    }
}

go run main.go started 2024/06/06 18:04:47 Connect failed: dial tcp 146.66.152.14:27017: connect: operation timed out

RandomNick2 commented 5 months ago

`
def bootstrap_from_webapi(self, cell_id=0): """ Fetches CM server list from WebAPI and replaces the current one

    :param cellid: cell id (0 = global)
    :type cellid: :class:`int`
    :return: booststrap success
    :rtype: :class:`bool`
    """
    self._LOG.debug("Attempting bootstrap via WebAPI")

    from steam import webapi
    try:
        resp = webapi.get('ISteamDirectory', 'GetCMList', 1, params={'cellid': cell_id,
                                                                     'http_timeout': 3})
    except Exception as exp:
        self._LOG.error("WebAPI boostrap failed: %s" % str(exp))
        return False

    result = EResult(resp['response']['result'])

    if result != EResult.OK:
        self._LOG.error("GetCMList failed with %s" % repr(result))
        return False

    serverlist = resp['response']['serverlist']
    self._LOG.debug("Received %d servers from WebAPI" % len(serverlist))

    def str_to_tuple(serveraddr):
        ip, port = serveraddr.split(':')
        return str(ip), int(port)

    self.clear()
    self.cell_id = cell_id
    self.merge_list(map(str_to_tuple, serverlist))

    return True`

   I think you need to add something like this