2022-07-25 11:29:46 +08:00
|
|
|
package option
|
|
|
|
|
2024-11-14 18:31:37 +08:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
|
|
|
"github.com/sagernet/sing/common/json"
|
|
|
|
)
|
|
|
|
|
2022-07-25 11:29:46 +08:00
|
|
|
type DirectInboundOptions struct {
|
|
|
|
ListenOptions
|
|
|
|
Network NetworkList `json:"network,omitempty"`
|
|
|
|
OverrideAddress string `json:"override_address,omitempty"`
|
|
|
|
OverridePort uint16 `json:"override_port,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-11-14 18:31:37 +08:00
|
|
|
type _DirectOutboundOptions struct {
|
2022-09-03 12:55:10 +08:00
|
|
|
DialerOptions
|
2024-11-14 18:31:37 +08:00
|
|
|
// Deprecated: Use Route Action instead
|
2022-07-25 11:29:46 +08:00
|
|
|
OverrideAddress string `json:"override_address,omitempty"`
|
2024-11-14 18:31:37 +08:00
|
|
|
// Deprecated: Use Route Action instead
|
|
|
|
OverridePort uint16 `json:"override_port,omitempty"`
|
|
|
|
// Deprecated: removed
|
|
|
|
ProxyProtocol uint8 `json:"proxy_protocol,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DirectOutboundOptions _DirectOutboundOptions
|
|
|
|
|
|
|
|
func (d *DirectOutboundOptions) UnmarshalJSONContext(ctx context.Context, content []byte) error {
|
|
|
|
err := json.UnmarshalDisallowUnknownFields(content, (*_DirectOutboundOptions)(d))
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if d.OverrideAddress != "" || d.OverridePort != 0 {
|
|
|
|
deprecated.Report(ctx, deprecated.OptionDestinationOverrideFields)
|
|
|
|
}
|
|
|
|
return nil
|
2022-07-25 11:29:46 +08:00
|
|
|
}
|