Profile: Add helper to check name validity
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
c59b3e1230
commit
99973a4b08
@ -20,6 +20,11 @@ import java.nio.charset.StandardCharsets;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class Profile extends BaseObservable implements Copyable<Profile>, Observable {
|
public class Profile extends BaseObservable implements Copyable<Profile>, Observable {
|
||||||
|
public static boolean isNameValid(String name) {
|
||||||
|
final int IFNAMSIZ = 16;
|
||||||
|
return !name.contains(" ") && name.getBytes(StandardCharsets.UTF_8).length <= IFNAMSIZ;
|
||||||
|
}
|
||||||
|
|
||||||
private final Interface iface = new Interface();
|
private final Interface iface = new Interface();
|
||||||
private boolean isConnected;
|
private boolean isConnected;
|
||||||
private String name;
|
private String name;
|
||||||
|
Loading…
Reference in New Issue
Block a user