package wireguard

import (
	"context"
	"net/netip"
	"time"

	Xbadoption "github.com/sagernet/sing-box/common/xray/json/badoption"
	tun "github.com/sagernet/sing-tun"
	"github.com/sagernet/sing/common/logger"
	M "github.com/sagernet/sing/common/metadata"
	N "github.com/sagernet/sing/common/network"
)

type EndpointOptions struct {
	Context                    context.Context
	Logger                     logger.ContextLogger
	System                     bool
	Handler                    tun.Handler
	UDPTimeout                 time.Duration
	Dialer                     N.Dialer
	CreateDialer               func(interfaceName string) N.Dialer
	Name                       string
	MTU                        uint32
	Address                    []netip.Prefix
	PrivateKey                 string
	ListenPort                 uint16
	ResolvePeer                func(domain string) (netip.Addr, error)
	Peers                      []PeerOptions
	Workers                    int
	PreallocatedBuffersPerPool uint32
	DisablePauses              bool
	Amnezia                    *AmneziaOptions
}

type PeerOptions struct {
	Endpoint                    M.Socksaddr
	PublicKey                   string
	PreSharedKey                string
	AllowedIPs                  []netip.Prefix
	PersistentKeepaliveInterval uint16
}

type AmneziaOptions struct {
	JC    int
	JMin  int
	JMax  int
	S1    int
	S2    int
	S3    int
	S4    int
	H1    *Xbadoption.Range
	H2    *Xbadoption.Range
	H3    *Xbadoption.Range
	H4    *Xbadoption.Range
	I1    string
	I2    string
	I3    string
	I4    string
	I5    string
	J1    string
	J2    string
	J3    string
	ITime int64
}
