{"id":797,"date":"2025-11-18T22:19:29","date_gmt":"2025-11-18T14:19:29","guid":{"rendered":"https:\/\/help.ipnut.com\/?post_type=docs&#038;p=797"},"modified":"2025-11-23T18:34:42","modified_gmt":"2025-11-23T10:34:42","password":"","slug":"go-language-integration-demo-ipnut-proxy-configuration-via-go","status":"publish","type":"docs","link":"https:\/\/www.ipnut.com\/help\/development-documentation\/go-language-integration-demo-ipnut-proxy-configuration-via-go\/","title":{"rendered":"Go Language Integration Demo IPNut Proxy Configuration via Go"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"797\" class=\"elementor elementor-797\" data-elementor-post-type=\"docs\">\n\t\t\t\t<div class=\"elementor-element elementor-element-69eafb8b e-con-full e-flex e-con e-parent\" data-id=\"69eafb8b\" data-element_type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bbcf013 elementor-widget elementor-widget-text-editor\" data-id=\"bbcf013\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p class=\"ds-markdown-paragraph\">After purchasing static IP services from the IPNut platform (example credentials:<\/p><ul><li><p class=\"ds-markdown-paragraph\">Endpoint:\u00a0<code>http:\/\/proxy.ipnut.com:28001<\/code><\/p><\/li><li><p class=\"ds-markdown-paragraph\">Username:\u00a0<code>ipnut<\/code><\/p><\/li><li><p class=\"ds-markdown-paragraph\">Password:\u00a0<code>123456789<\/code>),<br \/>use the following Go code samples for integration.<\/p><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-19aa3c9 elementor-widget elementor-widget-heading\" data-id=\"19aa3c9\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h6 class=\"elementor-heading-title elementor-size-default\">1. SOCKS5 Proxy Example<\/h6>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ba1c07a elementor-widget elementor-widget-code-highlight\" data-id=\"ba1c07a\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-go \">\n\t\t\t\t<code readonly=\"true\" class=\"language-go\">\n\t\t\t\t\t<xmp>package main\r\n\r\nimport (\r\n    \"crypto\/tls\"\r\n    \"fmt\"\r\n    \"io\"\r\n    \"net\/http\"\r\n    \"net\/url\"\r\n    \"time\"\r\n\r\n    \"golang.org\/x\/net\/proxy\"\r\n)\r\n\r\nfunc socks5ProxyDemo() {\r\n    fmt.Println(\"=== SOCKS5 Proxy Demo ===\")\r\n\r\n    \/\/ Configure SOCKS5 proxy parameters\r\n    proxyHost := \"proxy.ipnut.com\"\r\n    proxyPort := \"28001\"\r\n    proxyUsername := \"ipnut\"\r\n    proxyPassword := \"123456789\"\r\n\r\n    \/\/ Create authenticated SOCKS5 dialer\r\n    auth := &proxy.Auth{\r\n        User:     proxyUsername,\r\n        Password: proxyPassword,\r\n    }\r\n\r\n    dialer, err := proxy.SOCKS5(\"tcp\", \r\n        fmt.Sprintf(\"%s:%s\", proxyHost, proxyPort), \r\n        auth, \r\n        proxy.Direct,\r\n    )\r\n    if err != nil {\r\n        fmt.Printf(\"SOCKS5 dialer initialization failed: %v\\n\", err)\r\n        return\r\n    }\r\n\r\n    \/\/ Configure HTTP transport with SOCKS5 dialer\r\n    httpTransport := &http.Transport{\r\n        Dial: dialer.Dial,\r\n        TLSClientConfig: &tls.Config{\r\n            InsecureSkipVerify: false, \/\/ Enable certificate verification in production\r\n        },\r\n        MaxIdleConns:        100,\r\n        IdleConnTimeout:     90 * time.Second,\r\n        TLSHandshakeTimeout: 10 * time.Second,\r\n    }\r\n\r\n    \/\/ Initialize HTTP client\r\n    client := &http.Client{\r\n        Transport: httpTransport,\r\n        Timeout:   30 * time.Second,\r\n    }\r\n\r\n    \/\/ Execute test request\r\n    testURL := \"https:\/\/httpbin.org\/ip\"\r\n    fmt.Printf(\"Accessing via SOCKS5: %s\\n\", testURL)\r\n\r\n    resp, err := client.Get(testURL)\r\n    if err != nil {\r\n        fmt.Printf(\"Request failed: %v\\n\", err)\r\n        return\r\n    }\r\n    defer resp.Body.Close()\r\n\r\n    body, err := io.ReadAll(resp.Body)\r\n    if err != nil {\r\n        fmt.Printf(\"Response read failed: %v\\n\", err)\r\n        return\r\n    }\r\n\r\n    fmt.Printf(\"Status Code: %d\\n\", resp.StatusCode)\r\n    fmt.Printf(\"Response Body: %s\\n\", string(body))\r\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f7937f7 elementor-widget elementor-widget-heading\" data-id=\"f7937f7\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h6 class=\"elementor-heading-title elementor-size-default\">2. HTTP Proxy Example<\/h6>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-92b5055 elementor-widget elementor-widget-code-highlight\" data-id=\"92b5055\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-go \">\n\t\t\t\t<code readonly=\"true\" class=\"language-go\">\n\t\t\t\t\t<xmp>func httpProxyDemo() {\r\n    fmt.Println(\"=== HTTP Proxy Demo ===\")\r\n\r\n    \/\/ HTTP proxy configuration\r\n    proxyHost := \"proxy.ipnut.com\"\r\n    proxyPort := \"28001\"\r\n    proxyUsername := \"ipnut\"\r\n    proxyPassword := \"123456789\"\r\n\r\n    \/\/ Construct proxy URL with authentication\r\n    proxyURL := fmt.Sprintf(\"http:\/\/%s:%s@%s:%s\",\r\n        url.QueryEscape(proxyUsername),\r\n        url.QueryEscape(proxyPassword),\r\n        proxyHost,\r\n        proxyPort)\r\n\r\n    parsedProxy, err := url.Parse(proxyURL)\r\n    if err != nil {\r\n        fmt.Printf(\"Proxy URL parsing failed: %v\\n\", err)\r\n        return\r\n    }\r\n\r\n    \/\/ Configure HTTP transport with proxy\r\n    httpTransport := &http.Transport{\r\n        Proxy: http.ProxyURL(parsedProxy),\r\n        TLSClientConfig: &tls.Config{\r\n            InsecureSkipVerify: false, \/\/ Disable in production\r\n        },\r\n        MaxIdleConns:        100,\r\n        IdleConnTimeout:     90 * time.Second,\r\n        TLSHandshakeTimeout: 10 * time.Second,\r\n    }\r\n\r\n    client := &http.Client{\r\n        Transport: httpTransport,\r\n        Timeout:   30 * time.Second,\r\n    }\r\n\r\n    \/\/ Test request with custom headers\r\n    req, err := http.NewRequest(\"GET\", \"https:\/\/httpbin.org\/headers\", nil)\r\n    if err != nil {\r\n        fmt.Printf(\"Request creation failed: %v\\n\", err)\r\n        return\r\n    }\r\n    req.Header.Set(\"User-Agent\", \"IPNut-Go-Client\/1.0\")\r\n\r\n    resp, err := client.Do(req)\r\n    if err != nil {\r\n        fmt.Printf(\"Request execution failed: %v\\n\", err)\r\n        return\r\n    }\r\n    defer resp.Body.Close()\r\n\r\n    body, err := io.ReadAll(resp.Body)\r\n    if err != nil {\r\n        fmt.Printf(\"Response read failed: %v\\n\", err)\r\n        return\r\n    }\r\n\r\n    fmt.Printf(\"Status Code: %d\\n\", resp.StatusCode)\r\n    fmt.Printf(\"Response: %s\\n\", string(body))\r\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-970b7bc elementor-widget elementor-widget-heading\" data-id=\"970b7bc\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h6 class=\"elementor-heading-title elementor-size-default\">3. Main Function &amp; Project Configuration<\/h6>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2b93d55 elementor-widget elementor-widget-code-highlight\" data-id=\"2b93d55\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-go \">\n\t\t\t\t<code readonly=\"true\" class=\"language-go\">\n\t\t\t\t\t<xmp>func main() {\r\n    fmt.Println(\"Starting IPNut Proxy Connectivity Tests...\\n\")\r\n\r\n    \/\/ Execute proxy demonstrations\r\n    socks5ProxyDemo()\r\n    \r\n    fmt.Println(\"\\n\" + \"=\"*50 + \"\\n\")\r\n    \r\n    httpProxyDemo()\r\n\r\n    fmt.Println(\"\\nAll proxy tests completed!\")\r\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-088e8b8 elementor-widget elementor-widget-heading\" data-id=\"088e8b8\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h6 class=\"elementor-heading-title elementor-size-default\">4. Go Module Configuration<\/h6>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-83a5880 elementor-widget elementor-widget-code-highlight\" data-id=\"83a5880\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-go \">\n\t\t\t\t<code readonly=\"true\" class=\"language-go\">\n\t\t\t\t\t<xmp>module ipnut-proxy-demo\r\n\r\ngo 1.21\r\n\r\nrequire (\r\n    golang.org\/x\/net v0.17.0\r\n)<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3fbf29f elementor-widget elementor-widget-heading\" data-id=\"3fbf29f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h6 class=\"elementor-heading-title elementor-size-default\">5. Execution Commands:<\/h6>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1c965fa elementor-widget elementor-widget-code-highlight\" data-id=\"1c965fa\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-go \">\n\t\t\t\t<code readonly=\"true\" class=\"language-go\">\n\t\t\t\t\t<xmp># Initialize module\r\ngo mod init ipnut-proxy-demo\r\n\r\n# Install dependencies\r\ngo mod tidy\r\n\r\n# Execute demonstration\r\ngo run main.go<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fdf0030 elementor-widget elementor-widget-text-editor\" data-id=\"fdf0030\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Key Integration Notes:<\/p><ul><li><p class=\"ds-markdown-paragraph\">Replace example credentials with actual IPNut proxy details<\/p><\/li><li><p class=\"ds-markdown-paragraph\">Enable proper TLS certificate verification in production environments<\/p><\/li><li><p class=\"ds-markdown-paragraph\">Implement connection pooling for high-throughput applications<\/p><\/li><li><p class=\"ds-markdown-paragraph\">Add retry mechanisms for enhanced reliability<\/p><\/li><\/ul><p class=\"ds-markdown-paragraph\">Technical Support<br \/>For integration assistance or location-specific requirements:<\/p><ul><li><p class=\"ds-markdown-paragraph\">Email:\u00a0Support@ipnut.com<\/p><\/li><li><p class=\"ds-markdown-paragraph\">Live Chat:\u00a024\/7 via official <a href=\"https:\/\/www.ipnut.com\/\" target=\"_blank\" rel=\"noopener nofollow\">website<\/a><\/p><\/li><\/ul><p class=\"ds-markdown-paragraph\">*All code examples support both HTTP(S) and SOCKS5 protocols with enterprise-grade authentication.*<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>After purchasing sta [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"","ast-site-content-layout":"full-width-container","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"doc_category":[45],"doc_tag":[],"class_list":["post-797","docs","type-docs","status-publish","hentry","doc_category-development-documentation"],"year_month":"2026-05","word_count":500,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"admin","author_nicename":"admin","author_url":"https:\/\/help.ipnut.com\/author\/admin\/"},"doc_category_info":[{"term_name":"Development Documentation","term_url":"https:\/\/help.ipnut.com\/docs\/development-documentation\/"}],"doc_tag_info":[],"lang":"en","translations":{"en":797,"cn":645},"knowledge_base_info":[],"knowledge_base_slug":[],"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/docs\/797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/comments?post=797"}],"version-history":[{"count":7,"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/docs\/797\/revisions"}],"predecessor-version":[{"id":1149,"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/docs\/797\/revisions\/1149"}],"wp:attachment":[{"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/media?parent=797"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/doc_category?post=797"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/help.ipnut.com\/wp-json\/wp\/v2\/doc_tag?post=797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}