TP-Micro is a simple, powerful micro service framework based on Teleport.
The package has been moved to https://github.com/xiaoenai/tp-micro
TP-Micro is a simple, powerful micro service framework based on Teleport.
TP-Micro is a simple, powerful micro service framework based on Teleport.
The package has been moved to https://github.com/xiaoenai/tp-micro
有这样一种场景,我本地虚拟了多个IP地址,怎么能用指定的网卡IP地址发送请求?
客户端代码:
var (
cli *micro.Client
rerr *tp.Rerror
)
func main() {
cli = micro.NewClient(
micro.CliConfig{},
micro.NewStaticLinker(":6666"),
)
}
类似这样的:
import (
"net"
"net/http"
"time"
)
//url 要请求的URL
// ipaddr 当前网卡绑定的IP(一般都是网外IP)
func HttpGetFromIP(url, ipaddr string) (*http.Response, error) {
req, _ := http.NewRequest("GET", url, nil)
client := &http.Client{
Transport: &http.Transport{
Dial: func(netw, addr string) (net.Conn, error) {
//本地地址 ipaddr是本地外网IP
lAddr, err := net.ResolveTCPAddr(netw, ipaddr+":0")
if err != nil {
return nil, err
}
//被请求的地址
rAddr, err := net.ResolveTCPAddr(netw, addr)
if err != nil {
return nil, err
}
conn, err := net.DialTCP(netw, lAddr,rAddr)
if err != nil {
return nil, err
}
deadline := time.Now().Add(35 * time.Second)
conn.SetDeadline(deadline)
return conn, nil
},
},
}
req.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36")
return client.Do(req)
}
this rpc could support other language?
通用ant命令行创建项目:
NAME:
ant new - Create a new ant project
USAGE:
ant new [command options] [arguments...]
OPTIONS:
--script value, -s value 项目生成脚本文件的路径
--app_path value, -p value 新项目的路径
工作内容描述:
项目结构:
├── README.md
├── main.go
├── api
│ ├── handlers.gen.go
│ ├── handlers.go
│ ├── router.gen.go
│ └── router.go
├── logic
│ └── xxx.go
├── sdk
│ ├── rpc.gen.go
│ ├── rpc.gen_test.go
│ ├── rpc.go
│ └── rpc_test.go
└── types
├── types.gen.go
└── types.go
当前版本存在的问题:
应当升级当前代码文件:
https://github.com/henrylee2cn/ant/blob/master/cmd/ant/create/generator.go
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.