diff options
| author | Shulhan <ms@kilabit.info> | 2025-07-25 02:30:37 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-07-29 00:31:23 +0700 |
| commit | 0537c5e094c7b6e5ff376ccdf0dba80adf5c4342 (patch) | |
| tree | b8c2c3621c1e76c5182acdc2f09291b796792a9e /internal/internal.go | |
| parent | 3d4c7b48674cd553ce8f670933af9b609992ae77 (diff) | |
| download | lilin-0537c5e094c7b6e5ff376ccdf0dba80adf5c4342.tar.xz | |
all: refactoring Service to create with ServiceOptions
Instead of defining the options in the Service, create it in the
ServiceOptions and pass it to NewService function.
In this way, we can check it, initialize it, and set default value.
The Address option now use URL with scheme, so we can derive the
service type based on the scheme, for example "http://" for HTTP based
service, "tcp://xxx" for TCP based service, and so on.
Diffstat (limited to 'internal/internal.go')
| -rw-r--r-- | internal/internal.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/internal.go b/internal/internal.go new file mode 100644 index 0000000..ce6de02 --- /dev/null +++ b/internal/internal.go @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> +// SPDX-License-Identifier: GPL-3.0-only + +package internal + +import "time" + +// Now return the current time. +var Now = func() time.Time { + return time.Now() +} |
