mirror of
https://github.com/fatedier/frp.git
synced 2025-07-19 20:30:08 +07:00
add http proxy
add http proxy add proxy code add proxy
This commit is contained in:
32
models/plugin/http-proxy/proxy/config.go
Normal file
32
models/plugin/http-proxy/proxy/config.go
Normal file
@ -0,0 +1,32 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Config 保存代理服务器的配置
|
||||
type Config struct {
|
||||
Port string `json:"port"`
|
||||
Auth bool `json:"auth"`
|
||||
|
||||
User map[string]string `json:"user"`
|
||||
}
|
||||
|
||||
// 从指定json文件读取config配置
|
||||
func (c *Config) GetConfig(filename string) error {
|
||||
|
||||
configFile, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer configFile.Close()
|
||||
|
||||
br := bufio.NewReader(configFile)
|
||||
err = json.NewDecoder(br).Decode(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user