zoukankan      html  css  js  c++  java
  • How do I use SOCKS proxy in delphi?

    TCP
    ======

    For Indy 8.0

    In Delphi, do the following:

    IdTCPClient1.SocksInfo.Host := [the DNS name of the proxy server or its IP address]
    IdTCPClient1.SocksInfo.Protocol := [svNoSocks for no SOCKS support, svSocks4 for SOCKS 4, svSocks4A for SOCKS 4 with protocol extension, and svSocks5 for SOCKS 5 protocol]
    IdTCPClient1.SocksInfo.Authentication := [saNoAuthentication for no SOCKS authentication or saUsernamePassword for username and password authentication]

    In C++Builder, do the following:

    IdTCPClient1->SocksInfo->Host = [the DNS name of the proxy server or its IP address]
    IdTCPClient1->SocksInfo->Protocol = [svNoSocks for no SOCKS support, svSocks4 for SOCKS 4, svSocks4A for SOCKS 4 with protocol extension, and svSocks5 for SOCKS 5 protocol]
    IdTCPClient1->SocksInfo->Authentication = [saNoAuthentication for no SOCKS authentication or saUsernamePassword for username and password authentication]

    For Indy 9.0

    1. Create an IOHandler such as TIdIOHandlerSocket or TIdSSLIOHandlerSocket and assign the TCPClient.IOHandler property this.
    2. Create a TIdSocksInfo object and assign it to the IOHandler's SocksInfo property.
    3. Set the TIdSocksInfo properties as required.

    For Indy 10

    1. Create an IOHandler such as TIdIOHandlerStack or SSL IOHandler and assign the TCPClient.IOHandler property this.
    2. Create a TIdSocksInfo object and assign it to the IOHandler's TransparentProxy property.
    3. Set the TIdSocksInfo properties as required.
    4. If there is another proxy that the SOCKS Proxy itself needs to use, you have to use, set the Chained Proxy to a TIdCustomTransparentProxy such as TIdSocksInfo for another socks Proxy or a TIdConnectThroughHttpProxy for a HTTP Tunneling proxy.

    UDP
    ======

    Starting with Indy 10 build 51, we introduced the ability to use a SOCKS with UDP. However, this will only work with SOCKS protocol version 5 and the proxy server must support the UDP Associate method described in RFC 1928 - SOCKS Protocol Version 5.

    1. Create a TIdSocksInfo object and assign it to the TIdUDPClient.TransparentProxy property.
    2. Set the TIdSocksInfo properties as required.
    3. Call TIdUDPClient.OpenProxy just before you use any receive or send calls.
    4. After completing all of your receive and send calls, call TIdUDPClient.CloseProxy.

    or if you are using the optional TIdUDPClient.Connect and TIdUDPClient.Disconnect methods, you can simply:

    1. Create a TIdSocksInfo object and assign it to the TIdUDPClient.TransparentProxy property.
    2. Set the TIdSocksInfo properties as required.
    3. Call the TIdUDPClient.Connect method and it will open a connection to your proxy and call TIdUDPClient.Disconnect to close the connection to the proxy.

  • 相关阅读:
    单元化架构 定义问题
    STGW 下一代互联网标准传输协议QUIC大规模运营之路 wentaomao 腾讯技术工程 2021-02-01
    string
    进程管理工具 源码分析
    etcd 鉴权体系架构由控制面和数据面组成。
    HTTP/2 是基于二进制而不是文本
    分布式 ID 解决方案
    减少重复开发,GraphQL在低代码平台如何落地? 原创 随刻信息流团队 爱奇艺技术产品团队 2021-01-29
    设计模式混编:观察者模式+中介者模式
    mysql 语法总结
  • 原文地址:https://www.cnblogs.com/allegro/p/4952986.html
Copyright © 2011-2022 走看看