Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/AlexSSD7/linsk into fix-i…
Browse files Browse the repository at this point in the history
…ntel-macos
  • Loading branch information
AlexSSD7 committed Oct 13, 2023
2 parents 69e14e2 + d33eaf5 commit 30bac88
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var runCmd = &cobra.Command{

lg := slog.With("backend", shareBackendFlag)

shareURI, err := backend.Apply(ctx, sharePWD, &share.VMShareContext{
shareURI, err := backend.Apply(sharePWD, &share.VMShareContext{
Instance: i,
FileManager: fm,
NetTapCtx: tapCtx,
Expand Down
10 changes: 5 additions & 5 deletions nettap/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ type TapManager struct {
logger *slog.Logger
}

func NewTapManager(logger *slog.Logger) (*TapManager, error) {
func NewTapManager(_ *slog.Logger) (*TapManager, error) {
return nil, ErrTapManagerUnimplemented
}

func NewUniqueTapName() (string, error) {
return "", ErrTapManagerUnimplemented
}

func (tm *TapManager) CreateNewTap(tapName string) error {
func (tm *TapManager) CreateNewTap(_ string) error {
return ErrTapManagerUnimplemented
}

func ValidateTapName(s string) error {
func ValidateTapName(_ string) error {
return ErrTapManagerUnimplemented
}

func (tm *TapManager) DeleteTap(name string) error {
func (tm *TapManager) DeleteTap(_ string) error {
return ErrTapManagerUnimplemented
}

func (tm *TapManager) ConfigureNet(tapName string, hostCIDR string) error {
func (tm *TapManager) ConfigureNet(_ string, _ string) error {
return ErrTapManagerUnimplemented
}
2 changes: 1 addition & 1 deletion osspecifics/osspecifics_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// go:build darwin
//go:build darwin

package osspecifics

Expand Down
3 changes: 1 addition & 2 deletions share/afp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package share

import (
"context"
"fmt"
"net"

Expand Down Expand Up @@ -48,7 +47,7 @@ func NewAFPBackend(uc *UserConfiguration) (Backend, *VMShareOptions, error) {
}, nil
}

func (b *AFPBackend) Apply(ctx context.Context, sharePWD string, vc *VMShareContext) (string, error) {
func (b *AFPBackend) Apply(sharePWD string, vc *VMShareContext) (string, error) {
err := vc.FileManager.StartAFP(sharePWD)
if err != nil {
return "", errors.Wrap(err, "start afp server")
Expand Down
4 changes: 1 addition & 3 deletions share/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

package share

import "context"

type NewBackendFunc func(uc *UserConfiguration) (Backend, *VMShareOptions, error)

type Backend interface {
Apply(ctx context.Context, sharePWD string, vc *VMShareContext) (string, error)
Apply(sharePWD string, vc *VMShareContext) (string, error)
}

var backends = map[string]NewBackendFunc{
Expand Down
6 changes: 3 additions & 3 deletions share/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ func (rc RawUserConfiguration) Process(backend string, warnLogger *slog.Logger)

if backend == "ftp" {
if !listenIP.Equal(defaultListenIP) && ftpExtIP.Equal(defaultListenIP) {
slog.Warn("No external FTP IP address via --ftp-extip was configured. This is a requirement in almost all scenarios if you want to connect remotely.")
warnLogger.Warn("No external FTP IP address via --ftp-extip was configured. This is a requirement in almost all scenarios if you want to connect remotely.")
}
} else {
if !ftpExtIP.Equal(defaultListenIP) {
slog.Warn("FTP external IP address specification is ineffective with non-FTP backends", "selected", backend)
warnLogger.Warn("FTP external IP address specification is ineffective with non-FTP backends", "selected", backend)
}
}

if rc.SMBExtMode && backend != "smb" && !IsSMBExtModeDefault() {
slog.Warn("SMB external mode specification is ineffective with non-SMB backends")
warnLogger.Warn("SMB external mode specification is ineffective with non-SMB backends")
}

return &UserConfiguration{
Expand Down
3 changes: 1 addition & 2 deletions share/ftp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package share

import (
"context"
"fmt"
"net"

Expand Down Expand Up @@ -64,7 +63,7 @@ func NewFTPBackend(uc *UserConfiguration) (Backend, *VMShareOptions, error) {
}, nil
}

func (b *FTPBackend) Apply(ctx context.Context, sharePWD string, vc *VMShareContext) (string, error) {
func (b *FTPBackend) Apply(sharePWD string, vc *VMShareContext) (string, error) {
if vc.NetTapCtx != nil {
return "", fmt.Errorf("net taps are unsupported in ftp")
}
Expand Down
3 changes: 1 addition & 2 deletions share/smb.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package share

import (
"context"
"fmt"
"net"
"strings"
Expand Down Expand Up @@ -61,7 +60,7 @@ func NewSMBBackend(uc *UserConfiguration) (Backend, *VMShareOptions, error) {
}, nil
}

func (b *SMBBackend) Apply(ctx context.Context, sharePWD string, vc *VMShareContext) (string, error) {
func (b *SMBBackend) Apply(sharePWD string, vc *VMShareContext) (string, error) {
if b.sharePort != nil && vc.NetTapCtx != nil {
return "", fmt.Errorf("conflict: configured to use a forwarded port but a net tap configuration was detected")
}
Expand Down

0 comments on commit 30bac88

Please sign in to comment.