tls.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package option
  2. type InboundTLSOptions struct {
  3. Enabled bool `json:"enabled,omitempty"`
  4. ServerName string `json:"server_name,omitempty"`
  5. Insecure bool `json:"insecure,omitempty"`
  6. ALPN Listable[string] `json:"alpn,omitempty"`
  7. MinVersion string `json:"min_version,omitempty"`
  8. MaxVersion string `json:"max_version,omitempty"`
  9. CipherSuites Listable[string] `json:"cipher_suites,omitempty"`
  10. Certificate Listable[string] `json:"certificate,omitempty"`
  11. CertificatePath string `json:"certificate_path,omitempty"`
  12. Key Listable[string] `json:"key,omitempty"`
  13. KeyPath string `json:"key_path,omitempty"`
  14. ACME *InboundACMEOptions `json:"acme,omitempty"`
  15. ECH *InboundECHOptions `json:"ech,omitempty"`
  16. Reality *InboundRealityOptions `json:"reality,omitempty"`
  17. }
  18. type InboundTLSOptionsContainer struct {
  19. TLS *InboundTLSOptions `json:"tls,omitempty"`
  20. }
  21. type InboundTLSOptionsWrapper interface {
  22. TakeInboundTLSOptions() *InboundTLSOptions
  23. ReplaceInboundTLSOptions(options *InboundTLSOptions)
  24. }
  25. func (o *InboundTLSOptionsContainer) TakeInboundTLSOptions() *InboundTLSOptions {
  26. return o.TLS
  27. }
  28. func (o *InboundTLSOptionsContainer) ReplaceInboundTLSOptions(options *InboundTLSOptions) {
  29. o.TLS = options
  30. }
  31. type OutboundTLSOptions struct {
  32. Enabled bool `json:"enabled,omitempty"`
  33. DisableSNI bool `json:"disable_sni,omitempty"`
  34. ServerName string `json:"server_name,omitempty"`
  35. Insecure bool `json:"insecure,omitempty"`
  36. ALPN Listable[string] `json:"alpn,omitempty"`
  37. MinVersion string `json:"min_version,omitempty"`
  38. MaxVersion string `json:"max_version,omitempty"`
  39. CipherSuites Listable[string] `json:"cipher_suites,omitempty"`
  40. Certificate Listable[string] `json:"certificate,omitempty"`
  41. CertificatePath string `json:"certificate_path,omitempty"`
  42. ECH *OutboundECHOptions `json:"ech,omitempty"`
  43. UTLS *OutboundUTLSOptions `json:"utls,omitempty"`
  44. Reality *OutboundRealityOptions `json:"reality,omitempty"`
  45. }
  46. type OutboundTLSOptionsContainer struct {
  47. TLS *OutboundTLSOptions `json:"tls,omitempty"`
  48. }
  49. type OutboundTLSOptionsWrapper interface {
  50. TakeOutboundTLSOptions() *OutboundTLSOptions
  51. ReplaceOutboundTLSOptions(options *OutboundTLSOptions)
  52. }
  53. func (o *OutboundTLSOptionsContainer) TakeOutboundTLSOptions() *OutboundTLSOptions {
  54. return o.TLS
  55. }
  56. func (o *OutboundTLSOptionsContainer) ReplaceOutboundTLSOptions(options *OutboundTLSOptions) {
  57. o.TLS = options
  58. }
  59. type InboundRealityOptions struct {
  60. Enabled bool `json:"enabled,omitempty"`
  61. Handshake InboundRealityHandshakeOptions `json:"handshake,omitempty"`
  62. PrivateKey string `json:"private_key,omitempty"`
  63. ShortID Listable[string] `json:"short_id,omitempty"`
  64. MaxTimeDifference Duration `json:"max_time_difference,omitempty"`
  65. }
  66. type InboundRealityHandshakeOptions struct {
  67. ServerOptions
  68. DialerOptions
  69. }
  70. type InboundECHOptions struct {
  71. Enabled bool `json:"enabled,omitempty"`
  72. PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
  73. DynamicRecordSizingDisabled bool `json:"dynamic_record_sizing_disabled,omitempty"`
  74. Key Listable[string] `json:"key,omitempty"`
  75. KeyPath string `json:"key_path,omitempty"`
  76. }
  77. type OutboundECHOptions struct {
  78. Enabled bool `json:"enabled,omitempty"`
  79. PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
  80. DynamicRecordSizingDisabled bool `json:"dynamic_record_sizing_disabled,omitempty"`
  81. Config Listable[string] `json:"config,omitempty"`
  82. ConfigPath string `json:"config_path,omitempty"`
  83. }
  84. type OutboundUTLSOptions struct {
  85. Enabled bool `json:"enabled,omitempty"`
  86. Fingerprint string `json:"fingerprint,omitempty"`
  87. }
  88. type OutboundRealityOptions struct {
  89. Enabled bool `json:"enabled,omitempty"`
  90. PublicKey string `json:"public_key,omitempty"`
  91. ShortID string `json:"short_id,omitempty"`
  92. }