Skip to content

Commit

Permalink
Configutation file fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shoriwe committed May 27, 2022
1 parent d34b2b9 commit 871ed60
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 27 deletions.
3 changes: 2 additions & 1 deletion debug/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def test_http_with_http_no_auth():
proxies={
"http": "http://127.0.0.1:8080",
"https": "http://127.0.0.1:8080"
},verify=False
},verify=False,
headers={"Host": "localhost:8000"}
)
print(r.text)

Expand Down
8 changes: 4 additions & 4 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ Usage: fullproxy forward [ARGUMENTS]
Arguments:
-h, --help: Show this help message.
--listen="": Address to listen.
--master="": Listen address for master/slave communication.
--target="": Target address to redirect the traffic.
-dial-tls: Dial connection will use TLS
-listen string: Address to listen for clients. Argument URL structure is 'network://host:port'
-master string: Listen address for master/slave communication. Argument URL structure is 'network://host:port'
-target string: Target forward address. Argument URL structure is 'network://host:port'
```

## Translate
Expand Down
2 changes: 0 additions & 2 deletions internal/proxy/servers/reverse/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ func (H *HTTP) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
for key, values := range target.ResponseHeader {
clientResponseHeader[key] = values
}
// TODO: Do something to config this
upgrader := &websocket.Upgrader{
ReadBufferSize: host.WebsocketReadBufferSize,
WriteBufferSize: host.WebsocketWriteBufferSize,
Expand Down Expand Up @@ -164,7 +163,6 @@ func (H *HTTP) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
}
defer serverConnection.Close()
if host.TLSConfig != nil {
// TODO: Control this to trust in foreign certificate
serverConnection = tls.Client(serverConnection, host.TLSConfig)
}
server := &common.Sniffer{
Expand Down
1 change: 0 additions & 1 deletion internal/proxy/servers/reverse/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func (r *Raw) Handle(conn net.Conn) error {
return connectionError
}
if host.TLSConfig != nil {
// TODO: Do something to control tls config
targetConnection = tls.Client(targetConnection, host.TLSConfig)
}
return common.ForwardTraffic(
Expand Down
10 changes: 8 additions & 2 deletions sample-config/configs/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,20 @@ services:
uri: /
pool:
8001:
url: http://127.0.0.1:8001/name.txt
websocket-read-buffer-size: 1024
websocket-write-buffer-size: 1024
scheme: http
uri: /name.txt
network: tcp
address: 127.0.0.1:8001
localhost:8000:
uri: /
pool:
8002:
url: http://127.0.0.1:8002/name.txt
websocket-read-buffer-size: 1024
websocket-write-buffer-size: 1024
scheme: http
uri: /name.txt
network: tcp
address: 127.0.0.1:8002
reverse-raw:
Expand Down
36 changes: 19 additions & 17 deletions yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,24 @@ type (
}

Protocol struct {
Type string `yaml:"type"`
Authentication string `yaml:"authentication"`
DialTLS *DialTLS `yaml:"dial-tls"`
TargetNetwork string `yaml:"target-network"`
TargetAddress string `yaml:"target-address"`
ProxyNetwork string `yaml:"proxy-network"`
ProxyAddress string `yaml:"proxy-address"`
Translation string `yaml:"translation"`
Credentials string `yaml:"credentials"`
RawHosts map[string]*Host `yaml:"raw-hosts"`
HTTPHosts map[string]struct {
URI string `yaml:"uri"`
ResponseHeaders map[string]string `yaml:"response-headers"`
RequestHeaders map[string]string `yaml:"request-headers"`
Pool map[string]*Host `yaml:"pool"`
} `yaml:"http-hosts"`
Type string `yaml:"type"`
Authentication string `yaml:"authentication"`
DialTLS *DialTLS `yaml:"dial-tls"`
TargetNetwork string `yaml:"target-network"`
TargetAddress string `yaml:"target-address"`
ProxyNetwork string `yaml:"proxy-network"`
ProxyAddress string `yaml:"proxy-address"`
Translation string `yaml:"translation"`
Credentials string `yaml:"credentials"`
RawHosts map[string]*Host `yaml:"raw-hosts"`
HTTPHosts map[string]*Target `yaml:"http-hosts"`
}

Target struct {
URI string `yaml:"uri"`
ResponseHeaders map[string]string `yaml:"response-headers"`
RequestHeaders map[string]string `yaml:"request-headers"`
Pool map[string]*Host `yaml:"pool"`
}

DialTLS struct {
Expand All @@ -67,7 +69,7 @@ type (
URI string `yaml:"uri"`
Network string `yaml:"network"`
Address string `yaml:"address"`
TLSConfig *HostTLSConfig `yaml:"tls-config"`
TLSConfig *HostTLSConfig `yaml:"tls"`
}

HostTLSConfig struct {
Expand Down

0 comments on commit 871ed60

Please sign in to comment.