How to let pppoe connect with swift?

34 views Asked by At

I want to let the PPPOE net to connect with my MacBook. so I import the NetworkExtension package, but the error message told me "Cannot find 'NEPPPPoEConfiguration' in scope"

I need to help pls.QAQ

import SwiftUI
import NetworkExtension

struct ContentView: View {
  @State private var name = ""

  var body: some View {
    TextField("ID", text: $name).padding()
    Button {
      let config = NEPPPPoEConfiguration() // error:Cannot find 'NEPPPPoEConfiguration' in scope

      config.username = "your_username"
      config.password = "your_password"
      config.serviceName = "your_service_name"

      let manager = NEVPNManager()

      manager.configuration = config

      manager.startVPNTunnel()
    } label: {
      Text("Connect")
    }
  }
}

#Preview {
  ContentView()
}

I want my application can use pppoe connect to net.

0

There are 0 answers