-
-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathFtpOptions.cs
More file actions
190 lines (171 loc) · 7.17 KB
/
FtpOptions.cs
File metadata and controls
190 lines (171 loc) · 7.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// <copyright file="FtpOptions.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
using System;
namespace TestFtpServer.Configuration
{
/// <summary>
/// The root object for all options.
/// </summary>
public class FtpOptions
{
private FileSystemLayoutType? _layout;
/// <summary>
/// Gets or sets authentication providers to use.
/// </summary>
public MembershipProviderType Authentication { get; set; } = MembershipProviderType.Default;
/// <summary>
/// Gets or sets a value indicating whether user/group IDs will be set for file system operations.
/// </summary>
public bool SetFileSystemId { get; set; }
/// <summary>
/// Gets or sets the bits to be removed from the default file system entry permissions.
/// </summary>
public string? Umask { get; set; }
/// <summary>
/// Gets or sets the PAM authorization options.
/// </summary>
public PamAuthOptions Pam { get; set; } = new PamAuthOptions();
/// <summary>
/// Gets or sets the FTP server options.
/// </summary>
public FtpServerOptions Server { get; set; } = new FtpServerOptions();
/// <summary>
/// Gets or sets the FTP connection options.
/// </summary>
public FtpConnectionIdleCheckOptions Connection { get; set; } = new FtpConnectionIdleCheckOptions();
/// <summary>
/// Gets or sets the FTPS options.
/// </summary>
public FtpsOptions Ftps { get; set; } = new FtpsOptions();
/// <summary>
/// Gets or sets the file system backend to use.
/// </summary>
public string Backend
{
get
{
switch (BackendType)
{
case FileSystemType.AmazonS3: return "amazon-s3";
case FileSystemType.AzureBlobStorage: return "azureblobstorage";
case FileSystemType.InMemory: return "in-memory";
case FileSystemType.SystemIO: return "system-io";
case FileSystemType.Unix: return "unix";
case FileSystemType.GoogleDriveUser: return "google-drive:user";
case FileSystemType.GoogleDriveService: return "google-drive:service";
default: return "in-memory";
}
}
set
{
switch (value)
{
case "s3":
case "S3":
case "AmazonS3":
case "amazonS3":
case "amazon-s3":
BackendType = FileSystemType.AmazonS3;
break;
case "azureblobstorage":
BackendType = FileSystemType.AzureBlobStorage;
break;
case "inMemory":
case "in-memory":
BackendType = FileSystemType.InMemory;
break;
case "systemIo":
case "system-io":
BackendType = FileSystemType.SystemIO;
break;
case "unix":
BackendType = FileSystemType.Unix;
break;
case "googleDrive:user":
case "google-drive:user":
BackendType = FileSystemType.GoogleDriveUser;
break;
case "googleDrive:service":
case "google-drive:service":
BackendType = FileSystemType.GoogleDriveService;
break;
default:
throw new ArgumentOutOfRangeException(
$"Value must be one of \"in-memory\", \"system-io\", \"unix\", \"google-drive:user\", \"google-drive:service\", \"amazon-s3\", \"azureblobstorage\" but was , \"{value}\"");
}
}
}
/// <summary>
/// Gets or sets the file system layout to use.
/// </summary>
public string Layout
{
get
{
switch (_layout)
{
case FileSystemLayoutType.SingleRoot: return "single-root";
case FileSystemLayoutType.RootPerUser: return "root-per-user";
case FileSystemLayoutType.PamHome: return "pam-home";
case FileSystemLayoutType.PamHomeChroot: return "pam-home-chroot";
default: return "single-root";
}
}
set
{
switch (value)
{
case "default":
_layout = null;
break;
case "single-root":
_layout = FileSystemLayoutType.SingleRoot;
break;
case "root-per-user":
_layout = FileSystemLayoutType.RootPerUser;
break;
case "pam-home":
_layout = FileSystemLayoutType.PamHome;
break;
case "pam-home-chroot":
_layout = FileSystemLayoutType.PamHomeChroot;
break;
default:
throw new ArgumentOutOfRangeException(
$"Value must be one of \"single-root\", \"root-per-user\", \"pam-home\", \"pam-home-chroot\", but was , \"{value}\"");
}
}
}
/// <summary>
/// Gets or sets System.IO-based file system options.
/// </summary>
public FileSystemSystemIoOptions SystemIo { get; set; } = new FileSystemSystemIoOptions();
/// <summary>
/// Gets or sets Linux API-based file system options.
/// </summary>
public FileSystemUnixOptions Unix { get; set; } = new FileSystemUnixOptions();
/// <summary>
/// Gets or sets in-memory file system options.
/// </summary>
public FileSystemInMemoryOptions InMemory { get; set; } = new FileSystemInMemoryOptions();
/// <summary>
/// Gets or sets Google Drive file system options.
/// </summary>
public FileSystemGoogleDriveOptions GoogleDrive { get; set; } = new FileSystemGoogleDriveOptions();
/// <summary>
/// Gets or sets S3 system options.
/// </summary>
public FileSystemAmazonS3Options AmazonS3 { get; set; } = new FileSystemAmazonS3Options();
/// <summary>
/// Gets or sets azure blob storage system options.
/// </summary>
public FileSystemAzureBlobStorageOptions AzureBlobStorage { get; set; } = new FileSystemAzureBlobStorageOptions();
internal FileSystemLayoutType LayoutType
{
get => _layout ?? FileSystemLayoutType.SingleRoot;
set => _layout = value;
}
internal FileSystemType BackendType { get; set; } = FileSystemType.InMemory;
}
}