feat: expose transparent web device forwarders
This commit is contained in:
@@ -128,13 +128,22 @@ func (s *Service) Scan(r *http.Request) (*ScanResult, error) {
|
||||
}
|
||||
|
||||
s.allowIP(device.IP)
|
||||
forwardPort, forwardErr := s.EnsureForwarder(device.IP)
|
||||
if forwardErr != nil {
|
||||
result.Errors = append(result.Errors, fmt.Sprintf("%s: 启动%s透明转发失败: %v", iface.Name, device.IP, forwardErr))
|
||||
continue
|
||||
}
|
||||
|
||||
scheme, host := requestBase(r)
|
||||
|
||||
deviceInfo := DeviceInfo{
|
||||
IP: device.IP,
|
||||
Interface: iface.Name,
|
||||
Port: device.Port,
|
||||
TargetURL: fmt.Sprintf("http://%s/", device.IP),
|
||||
ProxyURL: fmt.Sprintf("/proxy/web/%s/", device.IP),
|
||||
IP: device.IP,
|
||||
Interface: iface.Name,
|
||||
Port: device.Port,
|
||||
TargetURL: fmt.Sprintf("http://%s/", device.IP),
|
||||
ProxyURL: fmt.Sprintf("/proxy/web/%s/", device.IP),
|
||||
DirectURL: buildDirectURL(scheme, host, forwardPort),
|
||||
ForwardPort: forwardPort,
|
||||
}
|
||||
result.Devices = append(result.Devices, deviceInfo)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user