mirror of
https://github.com/go-i2p/go-i2ptunnel-config.git
synced 2025-12-20 15:15:52 -05:00
parse targets
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
|||||||
// - Type: The type of the tunnel (string).
|
// - Type: The type of the tunnel (string).
|
||||||
// - Interface: The network interface to bind to (string, optional).
|
// - Interface: The network interface to bind to (string, optional).
|
||||||
// - Port: The port number to bind to (int, optional).
|
// - Port: The port number to bind to (int, optional).
|
||||||
|
// - Target: The target of the tunnel (string, optional).
|
||||||
// - PersistentKey: Indicates if the key should be persistent (bool, optional).
|
// - PersistentKey: Indicates if the key should be persistent (bool, optional).
|
||||||
// - Description: A description of the tunnel (string, optional).
|
// - Description: A description of the tunnel (string, optional).
|
||||||
// - I2CP: A map of I2CP (I2P Control Protocol) options (map[string]interface{}, optional).
|
// - I2CP: A map of I2CP (I2P Control Protocol) options (map[string]interface{}, optional).
|
||||||
@@ -23,6 +24,7 @@ type TunnelConfig struct {
|
|||||||
Type string `yaml:"type"`
|
Type string `yaml:"type"`
|
||||||
Interface string `yaml:"interface,omitempty"`
|
Interface string `yaml:"interface,omitempty"`
|
||||||
Port int `yaml:"port,omitempty"`
|
Port int `yaml:"port,omitempty"`
|
||||||
|
Target string `yaml:"target,omitempty"`
|
||||||
PersistentKey bool `yaml:"persistentKey,omitempty"`
|
PersistentKey bool `yaml:"persistentKey,omitempty"`
|
||||||
Description string `yaml:"description,omitempty"`
|
Description string `yaml:"description,omitempty"`
|
||||||
I2CP map[string]interface{} `yaml:"i2cp,omitempty"`
|
I2CP map[string]interface{} `yaml:"i2cp,omitempty"`
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ func (c *Converter) parseINI(input []byte) (*TunnelConfig, error) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
config.Port = port
|
config.Port = port
|
||||||
}
|
}
|
||||||
|
case "destination":
|
||||||
|
config.Target = value
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(key, "i2cp.") {
|
if strings.HasPrefix(key, "i2cp.") {
|
||||||
config.I2CP[strings.TrimPrefix(key, "i2cp.")] = value
|
config.I2CP[strings.TrimPrefix(key, "i2cp.")] = value
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ func (c *Converter) parsePropertyKey(k, s string, config *TunnelConfig) {
|
|||||||
config.PersistentKey = true
|
config.PersistentKey = true
|
||||||
case "description":
|
case "description":
|
||||||
config.Description = s
|
config.Description = s
|
||||||
|
case "targetDestination":
|
||||||
|
config.Target = s
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(parts[1], "option.i2cp") {
|
if strings.HasPrefix(parts[1], "option.i2cp") {
|
||||||
config.I2CP[parts[2]] = s
|
config.I2CP[parts[2]] = s
|
||||||
|
|||||||
Reference in New Issue
Block a user