Commit Graph

16 Commits

Author SHA1 Message Date
Samuel Holland
76eb65d7d5 Config: Make it Comparable
This will be used for future sorting.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 01:06:05 -05:00
Samuel Holland
f1d97a585a Config: Rename function to make databinding happy
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 00:57:27 -05:00
Samuel Holland
5e55d196be Major renaming and refactoring in activity and service
Apparently "configuration" is the proper term, not "profile".

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 07:24:03 -05:00
Samuel Holland
c72d30a1af Profile: Add function to copy config from another profile
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 07:23:16 -05:00
Samuel Holland
529e320e3f Interface: Correctly handle setting a null or empty key
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 02:51:54 -05:00
Samuel Holland
f0f9192aed KeyEncoding: Clean up and reorganize to match style
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 02:51:08 -05:00
Jason A. Donenfeld
f6b864d4e7 Constant time base64
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 18:22:41 +02:00
Samuel Holland
99973a4b08 Profile: Add helper to check name validity
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:54:35 -05:00
Samuel Holland
c59b3e1230 Profile: Make name modifiable
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:54:12 -05:00
Samuel Holland
874db0b95e Interface: Convert to using Keypair class
This allows retrieving the public key and generating keypairs, both of
which will be exposed in the UI.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-01 01:12:59 -05:00
Samuel Holland
ca708ba382 Profile: Implement deep copying
This is a simple, naive implementation that {,de}serializes the
profile's state, but it does not depend on the internal representation
of Profile or its contained classes.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:14:42 -05:00
Samuel Holland
c3b42b85cc Copyable: New utility interface for deep-copyable classes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:11:33 -05:00
Samuel Holland
a1e334efa6 Profile: Track connection state
Observability is only enabled for isConnected because it is the only
mutable property.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:13:01 -05:00
Samuel Holland
85f1d4f1d3 Profile: Add a blank line before each peer section
This is purely a cosmetic change in the generated config files.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 17:40:36 -05:00
Samuel Holland
748d780a47 Profile: Parse config file to a string per attribute
This parser should be able to handle any valid WireGuard or wg-quick
configuration file. It separates the file into a single interface object
and a peer object for each peer. All "[Interface]" sections in the file
are combined into the one object.

For now, later lines in a block with the same key overwrite earlier
lines. This is only relevant for attributes that are lists, such as
Address and AllowedIPs, where additional lines may be expected to append
to the list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 17:30:33 -05:00
Samuel Holland
0494dd1404 Profile: Add minimal implementation
This represents a wg-quick profile as two strings: the file name and
the file contents.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 06:08:54 -05:00