mirror of
https://github.com/duanhf2012/origin.git
synced 2026-03-13 11:37:41 +08:00
优化文件结构
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package sysmodule
|
package httpclientmodule
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/duanhf2012/origin/service"
|
"github.com/duanhf2012/origin/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HttpClientPoolModule struct {
|
type HttpClientModule struct {
|
||||||
service.Module
|
service.Module
|
||||||
client *http.Client
|
client *http.Client
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ func (slf *SyncHttpRespone) Get(timeoutMs int) HttpRespone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (slf *HttpClientPoolModule) Init(maxpool int, proxyUrl string) {
|
func (slf *HttpClientModule) Init(maxpool int, proxyUrl string) {
|
||||||
type ProxyFun func(_ *http.Request) (*url.URL, error)
|
type ProxyFun func(_ *http.Request) (*url.URL, error)
|
||||||
var proxyfun ProxyFun
|
var proxyfun ProxyFun
|
||||||
if proxyUrl != "" {
|
if proxyUrl != "" {
|
||||||
@@ -67,7 +67,7 @@ func (slf *HttpClientPoolModule) Init(maxpool int, proxyUrl string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (slf *HttpClientPoolModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone {
|
func (slf *HttpClientModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone {
|
||||||
ret := SyncHttpRespone{
|
ret := SyncHttpRespone{
|
||||||
resp: make(chan HttpRespone, 1),
|
resp: make(chan HttpRespone, 1),
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ func (slf *HttpClientPoolModule) SyncRequest(method string, url string, body []b
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (slf *HttpClientPoolModule) Request(method string, url string, body []byte, header http.Header) HttpRespone {
|
func (slf *HttpClientModule) Request(method string, url string, body []byte, header http.Header) HttpRespone {
|
||||||
if slf.client == nil {
|
if slf.client == nil {
|
||||||
panic("Call the init function first")
|
panic("Call the init function first")
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sysmodule
|
package mysqlmondule
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sysmodule
|
package redismodule
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sysservice
|
package httpservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sysservice
|
package tcpservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sysservice
|
package wsservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
Reference in New Issue
Block a user