示例#1
0
文件: main.go 项目: steve-wang/moses
func run(wd string, port int) error {
	userlist, err := NewUserList(wd)
	if err != nil {
		return err
	}
	acceptor := moses.NewSOCK5Acceptor(userlist)
	srv := moses.NewServer(acceptor, &moses.DirectConnector{})
	if err := srv.Start(uint16(port)); err != nil {
		return err
	}
	srv.Serve()
	return nil
}
示例#2
0
文件: main.go 项目: steve-wang/moses
func run(param *Param) error {
	connector := &moses.SOCKS5Connector{
		User:     param.User,
		Password: param.Password,
		Host:     param.ProxyHost,
		Port:     param.ProxyPort,
	}
	//acceptor := moses.NewSOCK5Acceptor(nil)
	acceptor := moses.SOCKS4Acceptor{}
	srv := moses.NewServer(acceptor, connector)
	if err := srv.Start(param.LocalPort); err != nil {
		return err
	}
	srv.Serve()
	return nil
}