Updated to latest tl schema, updated the proxy example
This commit is contained in:
parent
9c93ddf88a
commit
3ea3923bfb
|
@ -14,9 +14,6 @@ func main() {
|
|||
tdlib.SetLogVerbosityLevel(1)
|
||||
tdlib.SetFilePath("./errors.txt")
|
||||
|
||||
// You can set username and password if needed
|
||||
socksProxy := tdlib.ProxySocks5{Server: "127.0.0.1", Port: 1112}
|
||||
|
||||
// Create new instance of client
|
||||
client := tdlib.NewClient(tdlib.Config{
|
||||
APIID: "187786",
|
||||
|
@ -32,9 +29,16 @@ func main() {
|
|||
DatabaseDirectory: "./tdlib-db",
|
||||
FileDirectory: "./tdlib-files",
|
||||
IgnoreFileNames: false,
|
||||
SocksProxy: &socksProxy, // Set the socks proxy
|
||||
})
|
||||
|
||||
// You can set user-name and password to empty of don't need it
|
||||
// Socks5
|
||||
client.AddProxy("127.0.0.1", 1234, true, tdlib.NewProxyTypeSocks5("user-name", "password"))
|
||||
// HTTP - HTTPS proxy
|
||||
client.AddProxy("127.0.0.1", 1234, true, tdlib.NewProxyTypeHttp("user-name", "password", false))
|
||||
// MtProto Proxy
|
||||
client.AddProxy("127.0.0.1", 1234, true, tdlib.NewProxyTypeMtproto("MTPROTO-SECRET"))
|
||||
|
||||
// Handle Ctrl+C
|
||||
ch := make(chan os.Signal, 2)
|
||||
signal.Notify(ch, os.Interrupt, syscall.SIGTERM)
|
||||
|
|
1488
methods.go
1488
methods.go
File diff suppressed because it is too large
Load Diff
9
tdlib.go
9
tdlib.go
|
@ -69,7 +69,6 @@ type Config struct {
|
|||
UseSecretChats bool // If set to true, support for secret chats will be enabled.
|
||||
EnableStorageOptimizer bool // If set to true, old files will automatically be deleted.
|
||||
IgnoreFileNames bool // If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name.
|
||||
SocksProxy *ProxySocks5 // Pass a ProxySocks5 if you need socks5 proxy. Username and password can be nil
|
||||
}
|
||||
|
||||
// NewClient Creates a new instance of TDLib.
|
||||
|
@ -303,14 +302,6 @@ func (client *Client) Authorize() (AuthorizationState, error) {
|
|||
if ok == nil || err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if client.Config.SocksProxy != nil {
|
||||
ok, err = client.SetProxy(NewProxySocks5(client.Config.SocksProxy.Server, client.Config.SocksProxy.Port,
|
||||
client.Config.SocksProxy.Username, client.Config.SocksProxy.Password))
|
||||
if ok == nil || err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
authState, err := client.GetAuthorizationState()
|
||||
|
|
Loading…
Reference in New Issue