GithubHelp home page GithubHelp logo

haochen233 / socks5 Goto Github PK

View Code? Open in Web Editor NEW
47.0 5.0 9.0 77 KB

A Go library about socks5, supports all socks5 commands. That Provides server and client and easy to use. Compatible with socks4 and socks4a.

License: MIT License

Go 100.00%
socks5 socks4 socks4a full-featured socks-client socks-server golang go socks

socks5's Issues

how to transport data using proxy connection?

HI,I am new to go,I want to use this code to transport data in socks proxy connection,and i copy you example code and add some code as follows,but when connect is finished, the http request not use the proxy connection,could you have nay suggestions?thanks

package main

import (
	"crypto/md5"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"

	"github.com/haochen233/socks5"
)

func main() {
	var userStorage socks5.UserPwdStore = socks5.NewMemeryStore(md5.New(), "secret")
	client := socks5.Client{
		ProxyAddr: "192.168.66.1:1080",
		Auth: map[socks5.METHOD]socks5.Authenticator{
			socks5.NO_AUTHENTICATION_REQUIRED: &socks5.NoAuth{},
			socks5.USERNAME_PASSWORD:          &socks5.UserPwdAuth{UserPwdStore: userStorage},
		},
	}

	conn, err := client.Connect(socks5.Version5, "www.soso.com:80")
	if err != nil {
		log.Fatal(err)
	}

// code i add 
   _, err = conn.Write([]byte("GET / HTTP/1.1\r\n\r\n"))
    if err != nil {
        log.Fatal(err)
    }
    var httpBody string
    var httpSize int
    for {
        b := make([]byte, 4096)
        len, err := conn.Read(b)
        if err != nil {
            log.Fatal(err)
        }
        httpBody += string(b[:len])
        httpSize += len
        if b[len-1] == '\n' && len < 4096 {
            break
        }
    }
    log.Println(httpBody, httpSize)

	conn.Close()

}


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.